osgi

Managing access to OSGI bundles

拜拜、爱过 提交于 2019-12-12 14:59:18
问题 How can i control access to my bundles. I have a set of bundles that expose packages through export in MANIFEST.MF . Packages exposed are supposed to be used only within my set of bundles. No other external bundles should be allowed to use these packages using "import package". Is there any way i can impose these restrictions? 回答1: You can take a look at OSGi Security (2.Security Layer OSGi Core Spec) to manage restrictions to various resources (bundles, packages, services etc.). In your case

BND puts the same package to both export and import sections of manifest.mf

余生长醉 提交于 2019-12-12 14:39:35
问题 I have a Vaadin application, which I'm trying to build as a set of OSGI bundles using Maven + BND. I can't deploy the bundles To Apache Felix because some dependencies can't be resolved. Apache Felix complains that can't find package XYZ required by bundle "A", although this package is defined in this same bundle!! I looked at the MANIFEST.MF file generated by Maven + BND and saw that the package (XYZ) from this bundle is added to both "import" and "export" sections. I understand why "export"

how to deploy wab files in glassfish

元气小坏坏 提交于 2019-12-12 14:24:53
问题 What is the correct process of deploying a WAR OSGI file (WAB) to glassfish 3.1 server? I am copying the war file to "glassfish3\glassfish\domains\domain1\autodeploy\bundles\" -> OSGI recognizes the file as bundle and add it to its container. However, it doesn't deploy the war as web application (I cannot access its JSPs). To make it a web application, I deploy the war from glassfish admin console. Is it correct to deploy the same war twice? Shouldn't OSGI deploy it as WEB and OSGI? 回答1: To

How to maintain mutable state in a Java Singleton

拜拜、爱过 提交于 2019-12-12 14:02:40
问题 I have a Singelton in Java (in an OSGi Service) and want to maintain some state in it (a counter). Should this variable be static? or synchronized? or both? Or should i wrap the actions in a syncronized method? (would this be any different than just making the var syncronized?) I want consumers of the service actions to increment this counter. public MyServiceImpl implements MyService { private int count = 0; // static? syncronized? public String helloWorld() { count++; return "Hello World";

Finding files and folders in an OSGI Bundle

淺唱寂寞╮ 提交于 2019-12-12 11:10:45
问题 I am writing test cases that have to be executed in osgi environment, i have put the test data which is a set of files in the test bundle. I am able to access the test data files using bundle.getResource which returns an URL from which i can get the InputStream for a particular file, but how can i find out all the list of files in a particular folder in the test plugin. In eclispe i could use fileLocator to do this. /bundle testdata one.txt two.txt three.txt folder1 file1.txt file2.txt In the

How to get a Fragment-Bundle into Tycho test runtime?

倖福魔咒の 提交于 2019-12-12 10:50:50
问题 I have an implementation bundle and fragment bundle dependent on it (Fragment-Host in MANIFEST). Moreover, there is a bundle with some tests. Now I want to test my implementation and use the tycho-surefire-plugin. The bundle with tests refers to the implementation bundle by means of Require-Bundle in MANIFEST. So far so good. The question is how do I get the fragment bundle into the test runtime? I have tried the dependency in the configuration of the tycho-surefire-plugin in my eclipse-test

Problem integrating GWT and OSGi

╄→尐↘猪︶ㄣ 提交于 2019-12-12 09:57:36
问题 I have a problem integrating GWT into OSGi Equinox container. The entry point webpage runs. I see my first page. However, when I click on a button to realize server call, it does not run. I work with Firefox and I have firebug. Then, when I see network field I get the next message: Content-Type text/html; charset=iso-8859-1 Cache-Control must-revalidate,no-cache,no-store Content-Length 1431 Server Jetty(6.1.x) Host localhost User-Agent Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101

OSGi background thread failure

左心房为你撑大大i 提交于 2019-12-12 09:53:23
问题 What should be done when a BundleActivator runs a background thread, and that background thread has an unrecoverable error? public class Activator implements BundleActivator { private Thread t; @Override public void start(BundleContext context) throws Exception { t = new Thread(new Runnable(){ @Override public void run(){ while (!Thread.interrupted()){ // do something which may throw a runtime exception } } }); t.start(); } @Override void stop(BundleContext context) throws Exception { t

How to setup a proper equinox installation

荒凉一梦 提交于 2019-12-12 09:41:11
问题 I googled this for hours but I couldn't find anything useful. I have developed some OSGi bundles and now I want to run them outside of the Eclipse IDE in the equinox container, but it always throws an exception: !SESSION 2011-01-03 14:26:58.958 ----------------------------------------------- eclipse.buildId=unknown java.version=1.6.0_20 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_CH Framework arguments: -Dosgi.clean=true -Declipse.ignoreApp

Cq5.5 applying a servlet filter to a specific path

和自甴很熟 提交于 2019-12-12 08:53:15
问题 I'm working on a custom form handler in cq5.5 and everything is going great. I'm now working on locking down some of the security and one of my tasks is to implement a request throttling filter to the form handlers path. Currently I have something like @Component(immediate = true, metatype = true) @Service(javax.servlet.Filter.class) @Properties({ @Property(name="service.pid", value="com.xxxxxx.cq.core.filter.FormFilter",propertyPrivate=false), @Property(name="service.description",value=