jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig <mdue...@apache.org>
Subject Re: svn commit: r1333911 - in /jackrabbit/oak/trunk/oak-mk: pom.xml src/main/java/org/apache/jackrabbit/mk/osgi/Activator.java src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java
Date Fri, 04 May 2012 13:00:07 GMT

Hmm this seems to break the build for me.
Michael

On 4.5.12 13:37, thomasm@apache.org wrote:
> Author: thomasm
> Date: Fri May  4 12:37:04 2012
> New Revision: 1333911
>
> URL: http://svn.apache.org/viewvc?rev=1333911&view=rev
> Log:
> OAK-67 OSGi Bundle Setup - add an OSGi service for (in-memory and persisted) MicroKernel
instances
>
> Added:
>      jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java
>        - copied, changed from r1333794, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/Activator.java
> Removed:
>      jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/Activator.java
> Modified:
>      jackrabbit/oak/trunk/oak-mk/pom.xml
>
> Modified: jackrabbit/oak/trunk/oak-mk/pom.xml
> URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/pom.xml?rev=1333911&r1=1333910&r2=1333911&view=diff
> ==============================================================================
> --- jackrabbit/oak/trunk/oak-mk/pom.xml (original)
> +++ jackrabbit/oak/trunk/oak-mk/pom.xml Fri May  4 12:37:04 2012
> @@ -47,12 +47,22 @@
>                 org.apache.jackrabbit.mk.client,
>                 org.apache.jackrabbit.mk.blobs
>               </Export-Package>
> -<Bundle-Activator>
> -              org.apache.jackrabbit.mk.osgi.Activator
> -</Bundle-Activator>
>             </instructions>
>           </configuration>
>         </plugin>
> +<plugin>
> +<groupId>org.apache.felix</groupId>
> +<artifactId>maven-scr-plugin</artifactId>
> +<version>1.7.2</version>
> +<executions>
> +<execution>
> +<id>generate-scr-scrdescriptor</id>
> +<goals>
> +<goal>scr</goal>
> +</goals>
> +</execution>
> +</executions>
> +</plugin>
>       </plugins>
>       <pluginManagement>
>         <plugins>
> @@ -78,10 +88,22 @@
>         <optional>true</optional>
>       </dependency>
>       <dependency>
> +<groupId>org.osgi</groupId>
> +<artifactId>org.osgi.compendium</artifactId>
> +<scope>provided</scope>
> +<optional>true</optional>
> +</dependency>
> +<dependency>
>         <groupId>biz.aQute</groupId>
>         <artifactId>bndlib</artifactId>
>         <scope>provided</scope>
>       </dependency>
> +<dependency>
> +<groupId>org.apache.felix</groupId>
> +<artifactId>org.apache.felix.scr.annotations</artifactId>
> +<scope>provided</scope>
> +</dependency>
> +
>
>       <!-- commons dependency -->
>       <dependency>
>
> Copied: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java
(from r1333794, jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/Activator.java)
> URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java?p2=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java&p1=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/Activator.java&r1=1333794&r2=1333911&rev=1333911&view=diff
> ==============================================================================
> --- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/Activator.java
(original)
> +++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java
Fri May  4 12:37:04 2012
> @@ -16,31 +16,44 @@
>    */
>   package org.apache.jackrabbit.mk.osgi;
>
> -import java.util.Properties;
> -
> +import org.osgi.service.component.ComponentContext;
> +import org.apache.felix.scr.annotations.Component;
> +import org.apache.felix.scr.annotations.Deactivate;
> +import org.apache.felix.scr.annotations.Property;
> +import org.apache.felix.scr.annotations.Service;
> +import org.apache.felix.scr.annotations.Activate;
>   import org.apache.jackrabbit.mk.api.MicroKernel;
>   import org.apache.jackrabbit.mk.core.MicroKernelImpl;
> -import org.osgi.framework.BundleActivator;
> -import org.osgi.framework.BundleContext;
> -import org.osgi.framework.ServiceRegistration;
>
> -public class Activator implements BundleActivator {
> +@Component
> +@Service(MicroKernel.class)
> +public class MicroKernelService extends MicroKernelImpl {
> +
> +    @Property(description="The unique name of this instance")
> +    public static final String NAME = "name";
>
> -    private ServiceRegistration registration;
> +    @Property(description="The home directory (in-memory if not set)")
> +    public static final String HOME_DIR = "homeDir";
>
> -    //-----------------------------------------------------<  BundleActivator>--
> +    private String name;
>
>       @Override
> -    public void start(BundleContext context) throws Exception {
> -        registration = context.registerService(
> -                MicroKernel.class.getName(),
> -                new MicroKernelImpl(),
> -                new Properties());
> +    public String toString() {
> +        return name;
>       }
>
> -    @Override
> -    public void stop(BundleContext context) throws Exception {
> -        registration.unregister();
> +    @Activate
> +    public void activate(ComponentContext context) {
> +        Object homeDir = context.getProperties().get(HOME_DIR);
> +        name = "" + context.getProperties().get(NAME);
> +        if (homeDir != null) {
> +            init(homeDir.toString());
> +        }
> +    }
> +
> +    @Deactivate
> +    public void deactivate() {
> +        dispose();
>       }
>
>   }
>
>


Mime
View raw message