You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Christopher BROWN <br...@reflexe.fr> on 2013/09/19 08:44:31 UTC

Strategies for bundle repositories and auto-update

Hello,

What is the best strategy options for implementing a bundle repository
accessible over HTTP, where I can deploy a minimal instance of Felix (as
in, only a small set of bundles), then allow it to add bundles from the
repository to complete the application's feature set?

For example, the minimum application may have a dependency on a
javax.sql.DataSource (looking for a ServiceReference).  I'd like to detect
this unsatisfied requirement and then I could implement an appropriate
administrative UI to fetch and install the bundle providing the service,
based on a choice matching the customer's database platform.

Have I missed some API that provides this sort of
information/notification?  I could probably parse this information for
package dependencies (if I can detect a failure to resolve the bundle), but
I've not seen any way to parse service requirements.  I'm not sure if
declarative services would fit with the repository idea either.

And bonus question, is there any standard way to handle the case where the
repository provides a more recent version and then fetch/install it, IF it
matches the version range specified in the import range of the
class/interface used when looking up the service?

Thanks,
Christopher

Re: Strategies for bundle repositories and auto-update

Posted by Christopher BROWN <br...@reflexe.fr>.
Thankyou for the tip Roland.  I'll be investigating the Maven bundle plugin
(although I generally don't use Maven a lot).

--
Christopher


On 24 September 2013 12:27, Roland <wg...@ids.de> wrote:

> Christopher BROWN-2 wrote
> > [...]
> > Have I missed some API that provides this sort of
> > information/notification?  I could probably parse this information for
> > package dependencies (if I can detect a failure to resolve the bundle),
> > but
> > I've not seen any way to parse service requirements.  I'm not sure if
> > declarative services would fit with the repository idea either.
> > [...]
> > Christopher
>
> maybe you can add <Export-Service> or <Import-Service> to the instructions
> clause of the maven-bundle-plugin. After that, you are able to determine by
> parsing the bundle-headers / manifests which bundle requires a service that
> is provided by another bundle.
>
>
>
>
> --
> View this message in context:
> http://apache-felix.18485.x6.nabble.com/Strategies-for-bundle-repositories-and-auto-update-tp5005063p5005128.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Strategies for bundle repositories and auto-update

Posted by Roland <wg...@ids.de>.
Christopher BROWN-2 wrote
> [...]
> Have I missed some API that provides this sort of
> information/notification?  I could probably parse this information for
> package dependencies (if I can detect a failure to resolve the bundle),
> but
> I've not seen any way to parse service requirements.  I'm not sure if
> declarative services would fit with the repository idea either.
> [...]
> Christopher

maybe you can add <Export-Service> or <Import-Service> to the instructions
clause of the maven-bundle-plugin. After that, you are able to determine by
parsing the bundle-headers / manifests which bundle requires a service that
is provided by another bundle.




--
View this message in context: http://apache-felix.18485.x6.nabble.com/Strategies-for-bundle-repositories-and-auto-update-tp5005063p5005128.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

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


Re: Strategies for bundle repositories and auto-update

Posted by Roland <wg...@ids.de>.
Cristiano Gavião wrote
> Be aware that currently OBR generated by maven-bundle-plugin is not 
> compatible with the new R5 Repository service and with the repositories 
> that could be generated using OSGi Bindex tool.
> 
> With the new format you can create Federated repositories (a composition 
> of repositories)...
> 
> regards,
> 
> Cristiano
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 

> users-unsubscribe@.apache

> For additional commands, e-mail: 

> users-help@.apache


Thanks for the tip!
Roland



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Strategies-for-bundle-repositories-and-auto-update-tp5005063p5005139.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

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


Re: Strategies for bundle repositories and auto-update

Posted by Cristiano Gavião <cv...@gmail.com>.
Be aware that currently OBR generated by maven-bundle-plugin is not 
compatible with the new R5 Repository service and with the repositories 
that could be generated using OSGi Bindex tool.

With the new format you can create Federated repositories (a composition 
of repositories)...

regards,

Cristiano

On 19/09/13 04:56, Roland wrote:
> Christopher BROWN-2 wrote
>> [...]
>> What is the best strategy options for implementing a bundle repository
>> accessible over HTTP, where I can deploy a minimal instance of Felix (as
>> in, only a small set of bundles), then allow it to add bundles from the
>> repository to complete the application's feature set?
>> [...]
> I had the same problem and I solved it this way:
>
> You can use the maven-dependency-plugin to copy all POMs of runtime
> dependencies to a local folder. Then you can run the maven-resource-plugin,
> which generates the local OBR with all dependencies. The trick is to specify
> your application feature set as runtime dependencies e.g. the  Felix
> extensions. Thus, the Felix extensions are added to the local OBR. Now you
> only need to load the local OBR and to deploy all OBR-resources you want.
> referes to:
> http://apache-felix.18485.x6.nabble.com/Configure-Maven-OBR-Plugin-for-different-product-variants-td5003585.html
> (incomplete!!)
> But be aware: If you want to deploy resources of a locally generated OBR you
> have to map the lokal URLs to the proxy URLs. I simply cut off the lokal
> maven repository path and I append the proxy address.
>
> Please let me know if you have found another solution!!!!
>
> Regards
> Roland
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>    <modelVersion>4.0.0</modelVersion>
>    <parent>
>      <groupId>...</groupId>
>      <artifactId>...</artifactId>
>      <version>...</version>
>    </parent>
>    <groupId>...</groupId>
>    <artifactId>...</artifactId>
>    <name>...</name>
>    <description>..</description>
>    <packaging>pom</packaging>
>    <modules>
>      <module>your modules</module>
>      <module>...</module>
>      <module>...</module>
>    </modules>
>    <dependencies>
>      
>      <dependency>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>org.apache.felix.configadmin</artifactId>
>        <scope>runtime</scope>
>      </dependency>
>      <dependency>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>org.apache.felix.gogo.runtime</artifactId>
>        <scope>runtime</scope>
>      </dependency>
>      <dependency>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>org.apache.felix.gogo.command</artifactId>
>        <scope>runtime</scope>
>      </dependency>
>      <dependency>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>org.apache.felix.gogo.shell</artifactId>
>        <scope>runtime</scope>
>      </dependency>
>      <dependency>
>         <groupId>org.apache.felix</groupId>
>         <artifactId>org.apache.felix.framework.security</artifactId>
>         <scope>runtime</scope>
>      </dependency>
>      <dependency>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>org.apache.felix.scr</artifactId>
>        <scope>runtime</scope>
>      </dependency>
>      <dependency>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>org.apache.felix.metatype</artifactId>
>        <scope>runtime</scope>
>      </dependency>
>      <dependency>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>org.apache.felix.eventadmin</artifactId>
>        <scope>runtime</scope>
>      </dependency>
>    </dependencies>
>    <build>
>      <plugins>
>        
>        <plugin>
>          <groupId>org.apache.felix</groupId>
>          <artifactId>maven-bundle-plugin</artifactId>
>          <executions>
>            <execution>
>              <id>index</id>
>              <goals>
>                <goal>index</goal>
>              </goals>
>              <phase>verify</phase>
>              <configuration>
>               
> <mavenRepository>${project.build.directory}/dependency</mavenRepository>
>              </configuration>
>            </execution>
>          </executions>
>        </plugin>
>        
>        <plugin>
>          <artifactId>maven-resources-plugin</artifactId>
>          <version>2.6</version>
>          <executions>
>            <execution>
>              <id>copy-resources</id>
>              <phase>install</phase>
>              <goals>
>                <goal>copy-resources</goal>
>              </goals>
>              <configuration>
>               
> <outputDirectory>${project.parent.basedir}/${OBRDIR}/</outputDirectory>
>                <resources>
>                  <resource>
>                   
> <directory>${project.build.directory}/dependency/</directory>
>                    <includes>
>                      <include>repository.xml</include>
>                    </includes>
>                  </resource>
>                </resources>
>              </configuration>
>            </execution>
>          </executions>
>        </plugin>
>       
>        <plugin>
>          <artifactId>maven-deploy-plugin</artifactId>
>          <executions>
>            <execution>
>              <id>executable pom</id>
>              <phase>deploy</phase>
>              <goals>
>                <goal>deploy-file</goal>
>              </goals>
>              <configuration>
>                <groupId>...</groupId>
>                <artifactId>...</artifactId>
>                <name>...</name>
>                <description>...</description>
>                <version>1.0.0.0</version>
>                <packaging>xml</packaging>
>               
> <file>${project.parent.basedir}/${OBRDIR}/repository.xml</file>
>               
> <url>${project.parent.parent.distributionManagement.repository.url}</url>
>              </configuration>
>            </execution>
>          </executions>
>        </plugin>
>        <plugin>
>          <groupId>org.apache.maven.plugins</groupId>
>          <artifactId>maven-clean-plugin</artifactId>
>          <configuration>
>            <filesets>
>              <fileset>
>                <directory>${project.build.directory}/dependency</directory>
>                <includes>
>                  <include>**/*</include>
>                </includes>
>                <followSymlinks>false</followSymlinks>
>              </fileset>
>            </filesets>
>          </configuration>
>        </plugin>
>      </plugins>
>    </build>
> </project>
>
>
>
>
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Strategies-for-bundle-repositories-and-auto-update-tp5005063p5005070.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


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


Re: Strategies for bundle repositories and auto-update

Posted by Roland <wg...@ids.de>.
Christopher BROWN-2 wrote
> [...]
> What is the best strategy options for implementing a bundle repository
> accessible over HTTP, where I can deploy a minimal instance of Felix (as
> in, only a small set of bundles), then allow it to add bundles from the
> repository to complete the application's feature set?
> [...]

I had the same problem and I solved it this way:

You can use the maven-dependency-plugin to copy all POMs of runtime
dependencies to a local folder. Then you can run the maven-resource-plugin,
which generates the local OBR with all dependencies. The trick is to specify
your application feature set as runtime dependencies e.g. the  Felix
extensions. Thus, the Felix extensions are added to the local OBR. Now you
only need to load the local OBR and to deploy all OBR-resources you want.
referes to:
http://apache-felix.18485.x6.nabble.com/Configure-Maven-OBR-Plugin-for-different-product-variants-td5003585.html
(incomplete!!)
But be aware: If you want to deploy resources of a locally generated OBR you
have to map the lokal URLs to the proxy URLs. I simply cut off the lokal
maven repository path and I append the proxy address. 

Please let me know if you have found another solution!!!!

Regards
Roland

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>...</groupId>
    <artifactId>...</artifactId>
    <version>...</version>
  </parent>
  <groupId>...</groupId>
  <artifactId>...</artifactId>
  <name>...</name>
  <description>..</description>
  <packaging>pom</packaging>
  <modules>
    <module>your modules</module>
    <module>...</module>
    <module>...</module>
  </modules>
  <dependencies>
    
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.configadmin</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.gogo.runtime</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.gogo.command</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.gogo.shell</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.framework.security</artifactId>
       <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.scr</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.metatype</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.eventadmin</artifactId>
      <scope>runtime</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <executions>
          <execution>
            <id>index</id>
            <goals>
              <goal>index</goal>
            </goals>
            <phase>verify</phase>
            <configuration>
             
<mavenRepository>${project.build.directory}/dependency</mavenRepository>
            </configuration>
          </execution>
        </executions>
      </plugin>
      
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
        <executions>
          <execution>
            <id>copy-resources</id>
            <phase>install</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
             
<outputDirectory>${project.parent.basedir}/${OBRDIR}/</outputDirectory>
              <resources>
                <resource>
                 
<directory>${project.build.directory}/dependency/</directory>
                  <includes>
                    <include>repository.xml</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
     
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <executions>
          <execution>
            <id>executable pom</id>
            <phase>deploy</phase>
            <goals>
              <goal>deploy-file</goal>
            </goals>
            <configuration>
              <groupId>...</groupId>
              <artifactId>...</artifactId>
              <name>...</name>
              <description>...</description>
              <version>1.0.0.0</version> 
              <packaging>xml</packaging>
             
<file>${project.parent.basedir}/${OBRDIR}/repository.xml</file>
             
<url>${project.parent.parent.distributionManagement.repository.url}</url>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${project.build.directory}/dependency</directory>
              <includes>
                <include>**/*</include>
              </includes>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>




--
View this message in context: http://apache-felix.18485.x6.nabble.com/Strategies-for-bundle-repositories-and-auto-update-tp5005063p5005070.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

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


Re: Strategies for bundle repositories and auto-update

Posted by Roland <wg...@ids.de>.
As I understood you, you want to offer multiple software extension stages or
software variants/versions and you want to provide a repository that
satisfies all requirements of a given variant. If this is true, then you
want to do exactly the same thing what I'm doing. See the link of my first
email/post. You can create multiple *local* OBRs for each of your product
variant. One local OBR can be assigned to one particular software-variant.
Do not create a central OBR on your maven-proxy because it includes all
artifacts of all variants and thus, you can not distinguish which variant
which artifact requires.

For that purpose I embedded the Apache-Felix-Bundlrepository in my
Felix-launcher, so that I can load my OBRs at startup. Depending on my
product-variant, I read various local OBR files. Then I download *all*
requirements from my own Maven proxy, *that are listed in a particular OBR
file*. My last step is to deploy all Requiremtents in my bundle-cache. All
dependencies can be resolved. I do not care if not.

The advantage of OBRs is that you can guarantee that all dependencies can be
resolved, otherwise it is an error condition that has its origin in your
build process. So you do not have to determine at run time, which
requirement is unsatisfied (BTW this is very computationally expensive). The
dependencies are determined by Maven at compile-time. For additional Felix
extensions that have no dependency to your application, you can proceed as I
indicated in my first email / post.

Regards
Roland



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Strategies-for-bundle-repositories-and-auto-update-tp5005063p5005111.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

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


Re: Strategies for bundle repositories and auto-update

Posted by Christopher BROWN <br...@reflexe.fr>.
Hi Roland,

I asked the question in anticipation of a future requirement, further down
the product backlog.  I get the idea and plan to try it out, unfortunately
it'll be a few weeks before I get round to giving it a go.

It makes sense, so I'll look into it.

Very much appreciated, thanks.

--
Christopher



On 20 September 2013 19:03, Roland <wg...@ids.de> wrote:

> Has it helped you?
>
>
>
> --
> View this message in context:
> http://apache-felix.18485.x6.nabble.com/Strategies-for-bundle-repositories-and-auto-update-tp5005063p5005104.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Strategies for bundle repositories and auto-update

Posted by Roland <wg...@ids.de>.
Has it helped you?



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Strategies-for-bundle-repositories-and-auto-update-tp5005063p5005104.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

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