You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Pierre-Gildas MILLON <pg...@gmail.com> on 2012/01/22 15:32:18 UTC

Embedding felix & security provider

Hi everyone,

I'm trying to embed Felix in an application.
(I've already read 
http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html)

I can install & start a simple bundle but now I'd like to use the Felix 
Security Provider.
In my pom.xml, I embed all my felix dependencies 
(<Embed-Dependency>*;artifactId=org.apache.felix.*;inline=true</Embed-Dependency>).

In the final jar, the framework.security classes are present.
But the bundle apparently is not started.

When I add the framework.security.jar in the bundle folder, it's 
successfully installed.

How can I tell felix to start the framework.security bundle that is 
already located in the classpath at startup ?

Thanks.

Re: Embedding felix & security provider

Posted by Pierre-Gildas MILLON <pg...@gmail.com>.
Yipee, works great !!!
I was so simple.

Thanks to your sources, I found that I was just missing something in my 
config map.

pom.xml:

<configuration>
<instructions>
<Embed-Dependency>org.apache.felix.framework;inline=true,org.apache.felix.framework.security;inline=true</Embed-Dependency>
<Private-Package>com.mycompany.felix.*</Private-Package>
</instructions>
</configuration>

App.java:

     StringMap config = new StringMap(false);
     config.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, 
Arrays.asList(new BundleActivator[] {
       new SecurityActivator()
     }));
     config.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, 
"org.osgi.service.permissionadmin;version=\"1.2\","
       + 
"org.osgi.service.condpermadmin;uses:=\"org.osgi.service.permissionadmin\";version=\"1.1.1\","
       + "com.mycompany.felix;version=\"1.0\"");
     Framework fwk = new Felix(config);

Many thanks.

Regards,

Pierre-Gildas

Le 23/01/2012 09:58, Karl Pauls a écrit :
> You can find an example here:
>
> http://svn.apache.org/repos/asf/felix/sandbox/rickhall/ct-launcher/src/main/java/org/apache/felix/ct/FrameworkFactory.java
>
> however, you might want to consider adding the security provider
> bundle via the framework bundle api - the way we do it in the example
> above is Felix specific iirc (shouldn't matter much as the security
> provider is felix specific as well but just in case).
>
> regards,
>
> Karl
>
> On Sun, Jan 22, 2012 at 3:32 PM, Pierre-Gildas MILLON
> <pg...@gmail.com>  wrote:
>> Hi everyone,
>>
>> I'm trying to embed Felix in an application.
>> (I've already read
>> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html)
>>
>> I can install&  start a simple bundle but now I'd like to use the Felix
>> Security Provider.
>> In my pom.xml, I embed all my felix dependencies
>> (<Embed-Dependency>*;artifactId=org.apache.felix.*;inline=true</Embed-Dependency>).
>>
>> In the final jar, the framework.security classes are present.
>> But the bundle apparently is not started.
>>
>> When I add the framework.security.jar in the bundle folder, it's
>> successfully installed.
>>
>> How can I tell felix to start the framework.security bundle that is already
>> located in the classpath at startup ?
>>
>> Thanks.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Embedding felix & security provider

Posted by Karl Pauls <ka...@gmail.com>.
You can find an example here:

http://svn.apache.org/repos/asf/felix/sandbox/rickhall/ct-launcher/src/main/java/org/apache/felix/ct/FrameworkFactory.java

however, you might want to consider adding the security provider
bundle via the framework bundle api - the way we do it in the example
above is Felix specific iirc (shouldn't matter much as the security
provider is felix specific as well but just in case).

regards,

Karl

On Sun, Jan 22, 2012 at 3:32 PM, Pierre-Gildas MILLON
<pg...@gmail.com> wrote:
> Hi everyone,
>
> I'm trying to embed Felix in an application.
> (I've already read
> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html)
>
> I can install & start a simple bundle but now I'd like to use the Felix
> Security Provider.
> In my pom.xml, I embed all my felix dependencies
> (<Embed-Dependency>*;artifactId=org.apache.felix.*;inline=true</Embed-Dependency>).
>
> In the final jar, the framework.security classes are present.
> But the bundle apparently is not started.
>
> When I add the framework.security.jar in the bundle folder, it's
> successfully installed.
>
> How can I tell felix to start the framework.security bundle that is already
> located in the classpath at startup ?
>
> Thanks.



-- 
Karl Pauls
karlpauls@gmail.com
http://twitter.com/karlpauls
http://www.linkedin.com/in/karlpauls
https://profiles.google.com/karlpauls

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org