Hi Alex, Actually, etc/startup.properties doesn’t really use mvn. When you use mvn, Karaf is looking for the file in the system folder (as pax-url is not yet started).
So, you can use mvn (as soon as your bundle is in the system folder), file or reference. For the start level, it depends the dependencies that your bundle require. I would recommend to avoid SCR else you would need SCR in etc/startup.properties before your bundle. Just use a "regular" bundle with an activator. You will have limited dependencies. Regards JB > Le 15 avr. 2020 à 20:58, Alex Soto <[email protected]> a écrit : > > Thanks JB, would it work with file:// <file:///?> protocol, or only mvn? > Also, what start level do you recommend? > > Best regards, > Alex soto > > > > >> On Apr 15, 2020, at 1:55 PM, Jean-Baptiste Onofre <[email protected] >> <mailto:[email protected]>> wrote: >> >> Hi Alex, >> >> Yes, SystemService is exactly provided for that (it’s used by the >> halt/shutdown Karaf command). >> >> Another option (it’s basically what the SystemService is doing) is to do: >> bundleContext.stop(0); >> >> Bundle 0 is the system bundle (the framework basically). >> >> SystemService is a better option IMHO. >> >> If you want to be even faster, you can also have this bundle in >> etc/startup.properties (it’s before the feature service to boot features). >> >> Regards >> JB >> >>> Le 15 avr. 2020 à 17:25, Alex Soto <[email protected] >>> <mailto:[email protected]>> a écrit : >>> >>> Hello, >>> >>> What would be the best way to shutdown Karaf as soon as possible from a >>> Declarative Component that needs to run at startup. >>> This component will check some authorization API and decide if the user is >>> authorized to run the app. So, I thought to have a component with >>> @Component(immediate = true) and: >>> >>> @Reference >>> private SystemService systemService; >>> >>> @Activate >>> void init() { >>> if (!authorized()) { >>> systemService.halt(); >>> } >>> } >>> >>> >>> Is this a good approach? >>> Should I add the bundle containing this component as a boot feature? >>> Any other advise? >>> >>> >>> Best regards, >>> Alex soto >>> >>> >>> >>> >> >
