ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject [1/2] ignite git commit: IGNITE-1270 First iteration to make Ignite OSGi friendly. Details below.
Date Thu, 19 Nov 2015 19:28:06 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1270 [created] b6a80095d


http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/osgi/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi/pom.xml b/modules/osgi/pom.xml
new file mode 100644
index 0000000..c1418cc
--- /dev/null
+++ b/modules/osgi/pom.xml
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+    POM file.
+-->
+<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>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-osgi</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <url>http://ignite.apache.org</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>${osgi.core.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam</artifactId>
+            <version>4.6.0</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit4</artifactId>
+            <version>4.6.0</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-container-karaf</artifactId>
+            <version>4.6.0</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.karaf</groupId>
+            <artifactId>apache-karaf</artifactId>
+            <version>${karaf.version}</version>
+            <type>tar.gz</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
+            <version>1</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.url</groupId>
+            <artifactId>pax-url-aether</artifactId>
+            <version>2.4.3</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. 
+                 This bundle is a fragment attached to the ignite-core bundle, as it contains and exports classes in 
+                 the org.apache.ignite.internal.processors.query.h2.opt in the same manner as ignite-geospatial, thus 
+                 leading to a split package situation in OSGi. It also contains an internal processor.
+            -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Fragment-Host>org.apache.ignite.ignite-core</Fragment-Host>
+                    </instructions>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.servicemix.tooling</groupId>
+                <artifactId>depends-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate-depends-file</id>
+                        <goals>
+                            <goal>generate-depends-file</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <systemProperties>
+                        <property>
+                            <name>karafVersion</name>
+                            <value>${karaf.version}</value>
+                        </property>
+                        <property>
+                            <name>projectVersion</name>
+                            <value>${project.version}</value>
+                        </property>
+                        <property>
+                            <name>java.protocol.handler.pkgs</name>
+                            <value>org.ops4j.pax.url</value>
+                        </property>
+                    </systemProperties>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+    
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteOsgiContextActivator.java
----------------------------------------------------------------------
diff --git a/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteOsgiContextActivator.java b/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteOsgiContextActivator.java
new file mode 100644
index 0000000..f8dd57a
--- /dev/null
+++ b/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteOsgiContextActivator.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.osgi;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.osgi.classloaders.BundleDelegatingClassLoader;
+import org.apache.ignite.osgi.classloaders.ContainerSweepClassLoader;
+import org.apache.ignite.osgi.classloaders.OsgiClassLoadingStrategyType;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * This {@link BundleActivator} starts Apache Ignite inside the OSGi container when the bundle is started.
+ * <p>
+ * Create an implementation of this class and set the {@code Bundle-Activator} OSGi Manifest header to the FQN of
+ * your class.
+ * <p>
+ * You must provide the {@link IgniteConfiguration} to start by implementing the {@link #igniteConfiguration()}
+ * abstract method. The return value of this method cannot be {@code null}. For example, if your implementation is
+ * called {@code org.myorg.osgi.IgniteActivator}, your bundle must provide the following header:
+ *
+ * <pre>
+ *     Bundle-Activator: org.myorg.osgi.IgniteActivator
+ * </pre>
+ *
+ * You may use the
+ * <a href="https://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html">Maven
+ * Bundle Plugin</a> to generate your bundle (or bundle manifest), including the required header.
+ * <p>
+ * This activator also exports the Ignite instance as an OSGi service, with the property {@code ignite.name} set
+ * to the value of {@link Ignite#name()}, if and only if the name is not null.
+ * <p>
+ * Currently, Ignite only allows a single instance per container. We may remove this limitation if enough demand
+ * builds up in the community.
+ *
+ * @see <a href="http://wiki.osgi.org/wiki/Bundle-Activator">Bundle-Activator OSGi Manifest header</a>.
+ *
+ */
+public abstract class IgniteOsgiContextActivator implements BundleActivator {
+
+    /** OSGI service property name. */
+    public static final String OSGI_SERVICE_PROP_IGNITE_NAME = "ignite.name";
+
+    /** The instance of Ignite started by this Activator. */
+    protected Ignite ignite;
+
+    /** Our bundle context. */
+    private BundleContext bundleContext;
+
+    /** Ignite logger. */
+    private IgniteLogger logger;
+
+    /**
+     * Method invoked by OSGi to start the bundle. It starts the specified Ignite configuration.
+     *
+     * @param context Bundle context.
+     * @throws Exception
+     */
+    @Override public void start(BundleContext context) throws Exception {
+        // Ensure that no other instances are running.
+        if (IgniteOsgiUtils.gridCount() > 0) {
+            throw new IgniteException("Failed to start Ignite instance (another instance is already running " +
+                "and ignite-osgi is currently limited to a single instance per container).");
+        }
+
+        bundleContext = context;
+
+        // Start the Ignite configuration specified by the user.
+        IgniteConfiguration config = igniteConfiguration();
+
+        A.notNull(config, "Ignite configuration cannot be null");
+
+        // Override the classloader with the classloading strategy chosen by the user.
+        ClassLoader clsLdr;
+
+        if (classLoadingStrategy() == OsgiClassLoadingStrategyType.BUNDLE_DELEGATING)
+            clsLdr = new BundleDelegatingClassLoader(bundleContext.getBundle(), Ignite.class.getClassLoader());
+        else
+            clsLdr = new ContainerSweepClassLoader(bundleContext.getBundle(), Ignite.class.getClassLoader());
+
+        config.setClassLoader(clsLdr);
+
+        // Start Ignite.
+        ignite = Ignition.start(config);
+
+        logger = ignite.log();
+
+        logger.info("Started Ignite from OSGi Activator [name=" + ignite.name() + ']');
+
+        // Add into Ignite's OSGi registry.
+        IgniteOsgiUtils.classloaders().put(ignite, clsLdr);
+
+        // Export Ignite as a service.
+        exportOsgiService(ignite);
+
+    }
+
+    /**
+     * Stops Ignite when the bundle is stopping.
+     *
+     * @param context Bundle context.
+     * @throws Exception
+     */
+    @Override public void stop(BundleContext context) throws Exception {
+        try {
+            ignite.close();
+        }
+        catch (Exception e) {
+            logger.error("Failed to stop Ignite via OSGi Activator [errMsg=" + e.getMessage() + ']');
+            return;
+        }
+
+        logger.info("Stopped Ignite from OSGi Activator [name=" + ignite.name() + ']');
+
+        IgniteOsgiUtils.classloaders().remove(ignite);
+    }
+
+    /**
+     * Override this method to provide the Ignite configuration this bundle will start.
+     *
+     * @return The Ignite configuration.
+     */
+    public abstract IgniteConfiguration igniteConfiguration();
+
+    /**
+     * Override this method to indicate which classloading strategy to use.
+     *
+     * @return The strategy.
+     */
+    public OsgiClassLoadingStrategyType classLoadingStrategy() {
+        return OsgiClassLoadingStrategyType.BUNDLE_DELEGATING;
+    }
+
+    /**
+     * Exports the Ignite instance onto the OSGi Service Registry.
+     * @param ignite
+     */
+    private void exportOsgiService(Ignite ignite) {
+        Dictionary<String, String> dict = new Hashtable<>();
+
+        // Only add the service property if the grid name != null.
+        if (ignite.name() != null) {
+            dict.put(OSGI_SERVICE_PROP_IGNITE_NAME, ignite.name());
+        }
+
+        bundleContext.registerService(Ignite.class, ignite, dict);
+
+        logger.info("Exported OSGi service for Ignite with properties " + dict);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteOsgiUtils.java
----------------------------------------------------------------------
diff --git a/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteOsgiUtils.java b/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteOsgiUtils.java
new file mode 100644
index 0000000..c49ec86
--- /dev/null
+++ b/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteOsgiUtils.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.osgi;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.ignite.Ignite;
+
+import org.jsr166.ConcurrentHashMap8;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * Helper for OSGi.
+ */
+public class IgniteOsgiUtils {
+
+    /** Whether we are running in an OSGi container. */
+    private static boolean osgi = FrameworkUtil.getBundle(IgniteOsgiUtils.class) != null;
+
+    /** Maps Ignite instances to the ClassLoaders of the bundles they were started from. */
+    private static final ConcurrentMap<Ignite, ClassLoader> CLASSLOADERS = new ConcurrentHashMap8<>();
+
+    /**
+     * Private constructor.
+     */
+    private IgniteOsgiUtils() { }
+
+    /**
+     * Returns whether we are running in an OSGi environment.
+     *
+     * @return
+     */
+    public static boolean isOsgi() {
+        return osgi;
+    }
+
+    /**
+     * Returns a {@link Map} of {@link Ignite} instances and the classloaders of the {@link Bundle}s they were
+     * started from.
+     *
+     * @return The {@link Map}.
+     */
+    public static Map<Ignite, ClassLoader> classloaders() {
+        return CLASSLOADERS;
+    }
+
+    /**
+     * Returns the number of grids currently running in this OSGi container.
+     *
+     * @return The grid count.
+     */
+    public static int gridCount() {
+        return CLASSLOADERS.size();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/BundleDelegatingClassLoader.java
----------------------------------------------------------------------
diff --git a/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/BundleDelegatingClassLoader.java b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/BundleDelegatingClassLoader.java
new file mode 100644
index 0000000..f3cd873
--- /dev/null
+++ b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/BundleDelegatingClassLoader.java
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.osgi.classloaders;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.apache.ignite.internal.util.typedef.internal.SB;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * A {@link ClassLoader} implementation delegating to a given OSGi bundle, and to the specified {@link ClassLoader}
+ * as a fallback.
+ */
+public class BundleDelegatingClassLoader extends ClassLoader {
+
+    /** The bundle which loaded Ignite. */
+    protected final Bundle bundle;
+
+    /** The fallback classloader, expected to be the ignite-core classloader. */
+    protected final ClassLoader clsLdr;
+
+    /**
+     * Constructor.
+     *
+     * @param bundle The bundle
+     */
+    public BundleDelegatingClassLoader(Bundle bundle) {
+        this(bundle, null);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param bundle The bundle.
+     * @param classLoader Fallback classloader.
+     */
+    public BundleDelegatingClassLoader(Bundle bundle, ClassLoader classLoader) {
+        this.bundle = bundle;
+        this.clsLdr = classLoader;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Class<?> findClass(String name) throws ClassNotFoundException {
+        return bundle.loadClass(name);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected URL findResource(String name) {
+        URL resource = bundle.getResource(name);
+
+        if (resource == null && clsLdr != null)
+            resource = clsLdr.getResource(name);
+
+        return resource;
+    }
+
+    /**
+     * Finds a given resource from within the {@link #bundle}.
+     *
+     * @param name The resource name.
+     * @return URLs of resources.
+     * @throws IOException
+     */
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    protected Enumeration findResources(String name) throws IOException {
+        return bundle.getResources(name);
+    }
+
+    /**
+     * Loads a class trying the {@link #bundle} first, falling back to the ClassLoader {@link #clsLdr}.
+     *
+     * @param name Class name.
+     * @param resolve {@code true} to resolve the class.
+     * @return The Class.
+     * @throws ClassNotFoundException
+     */
+    @Override
+    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+        Class<?> cls;
+
+        try {
+            cls = findClass(name);
+        }
+        catch (ClassNotFoundException e) {
+            if (clsLdr == null)
+                throw classNotFoundException(name);
+
+            try {
+                cls = clsLdr.loadClass(name);
+            }
+            catch (ClassNotFoundException e2) {
+                throw classNotFoundException(name);
+            }
+
+        }
+
+        if (resolve)
+            resolveClass(cls);
+
+        return cls;
+    }
+
+    /**
+     * Returns the {@link Bundle} to which this ClassLoader is associated.
+     *
+     * @return The Bundle.
+     */
+    public Bundle getBundle() {
+        return bundle;
+    }
+
+    /**
+     * @return
+     */
+    @Override
+    public String toString() {
+        return String.format("%s[%s]", getClass().getSimpleName(), bundle);
+    }
+
+    /**
+     * Builds a {@link ClassNotFoundException}.
+     *
+     * @param clsName Class name.
+     * @return The exception.
+     */
+    protected ClassNotFoundException classNotFoundException(String clsName) {
+        String s = new SB("Failed to resolve class [name=").a(clsName)
+            .a(", bundleId=").a(bundle.getBundleId())
+            .a(", symbolicName=").a(bundle.getSymbolicName())
+            .a(", fallbackClsLdr=").a(clsLdr).a("]").toString();
+
+        return new ClassNotFoundException(s);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/ContainerSweepClassLoader.java
----------------------------------------------------------------------
diff --git a/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/ContainerSweepClassLoader.java b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/ContainerSweepClassLoader.java
new file mode 100644
index 0000000..7c11dcf
--- /dev/null
+++ b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/ContainerSweepClassLoader.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.osgi.classloaders;
+
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
+
+import org.jsr166.ConcurrentHashMap8;
+import org.osgi.framework.Bundle;
+
+/**
+ * A {@link ClassLoader} implementation that first attempts to load the class from the associated {@link Bundle}. As
+ * a fallback, it sweeps the entire OSGi container to find the requested class, returning the first hit.
+ * <p>
+ * It keeps a cache of resolved classes and unresolvable classes, in order to optimize subsequent lookups.
+ */
+public class ContainerSweepClassLoader extends BundleDelegatingClassLoader {
+
+    /** Classes resolved previously. */
+    private final ConcurrentMap<String, Bundle> resolved = new ConcurrentHashMap8<>();
+
+    /** Unresolvable classes. */
+    private final Set<String> nonResolvable = new GridConcurrentHashSet<>();
+
+    /**
+     * Constructor with a {@link Bundle} only.
+     *
+     * @param bundle The bundle.
+     */
+    public ContainerSweepClassLoader(Bundle bundle) {
+        super(bundle);
+    }
+
+    /**
+     * Constructor with a {@link Bundle} and another {@link ClassLoader} to check.
+     *
+     * @param bundle The bundle.
+     * @param classLoader The other classloader to check.
+     */
+    public ContainerSweepClassLoader(Bundle bundle, ClassLoader classLoader) {
+        super(bundle, classLoader);
+    }
+
+    /**
+     * Runs the same logic to find the class as {@link BundleDelegatingClassLoader}, but if not found, sweeps the
+     * OSGi container to locate the first {@link Bundle} that can load the class, and uses it to do so.
+     *
+     * @param name The classname.
+     * @param resolve Whether to resolve the class or not.
+     * @return The loaded class.
+     * @throws ClassNotFoundException
+     */
+    @Override
+    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+        // If we know it's not resolvable, throw the exception immediately.
+        if (nonResolvable.contains(name))
+            throw classNotFoundException(name);
+
+        Class<?> cls;
+
+        // First, delegate to super, and return the class if found.
+        try {
+            cls = super.loadClass(name, resolve);
+            return cls;
+        }
+        catch (ClassNotFoundException e) {
+            // Continue.
+        }
+
+        // Else, check the cache.
+        if (resolved.containsKey(name))
+            return resolved.get(name).loadClass(name);
+
+        // If still unresolved, sweep the container.
+        cls = sweepContainer(name);
+
+        // If still unresolved, throw the exception.
+        if (cls == null)
+            throw classNotFoundException(name);
+
+        return cls;
+    }
+
+    /**
+     * Sweeps the OSGi container to find the first {@link Bundle} that can load the class.
+     *
+     * @param name The classname.
+     * @return The loaded class.
+     */
+    protected Class<?> sweepContainer(String name) {
+        Class<?> cls = null;
+
+        Bundle[] bundles = bundle.getBundleContext().getBundles();
+
+        int bundleIdx = 0;
+
+        for (; bundleIdx < bundles.length; bundleIdx++) {
+            try {
+                cls = bundles[bundleIdx].loadClass(name);
+                break;
+            }
+            catch (ClassNotFoundException e) {
+                continue;
+            }
+        }
+
+        if (cls == null)
+            nonResolvable.add(name);
+        else
+            resolved.put(name, bundles[bundleIdx]);
+
+        return cls;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/OsgiClassLoadingStrategyType.java
----------------------------------------------------------------------
diff --git a/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/OsgiClassLoadingStrategyType.java b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/OsgiClassLoadingStrategyType.java
new file mode 100644
index 0000000..939aca7
--- /dev/null
+++ b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/OsgiClassLoadingStrategyType.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.osgi.classloaders;
+
+/**
+ * Enum for the user to indicate which type of {@link ClassLoader} Ignite should use.
+ */
+public enum OsgiClassLoadingStrategyType {
+
+    /** Use this value for {@link BundleDelegatingClassLoader}. */
+    BUNDLE_DELEGATING,
+
+    /** Use this value for {@link ContainerSweepClassLoader}. */
+    CONTAINER_SWEEP
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteKarafFeaturesInstallationTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteKarafFeaturesInstallationTest.java b/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteKarafFeaturesInstallationTest.java
new file mode 100644
index 0000000..4fcfd30
--- /dev/null
+++ b/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteKarafFeaturesInstallationTest.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.osgi;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import javax.inject.Inject;
+
+import org.apache.karaf.features.Feature;
+import org.apache.karaf.features.FeaturesService;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFileExtend;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+
+/**
+ * Pax Exam test class to check if all features could be resolved and installed.
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
+public class IgniteKarafFeaturesInstallationTest {
+
+    /** Features we do not expect to be installed. */
+    private static final Set<String> IGNORED_FEATURES = new HashSet<>(
+        Arrays.asList("ignite-log4j", "ignite-scalar-2.10"));
+
+    /** Regex matching ignite features. */
+    private static final String IGNITE_FEATURES_NAME_REGEX = "ignite.*";
+
+    /** Project version. */
+    private static final String PROJECT_VERSION = System.getProperty("projectVersion");
+
+    /** Pax Exam will inject the Bundle Context here. */
+    @Inject
+    private BundleContext bundleCtx;
+
+    /** Pax Exam will inject the Karaf Features Service. */
+    @Inject
+    private FeaturesService featuresSvc;
+
+    /**
+     * Returns configuration for Karaf container.
+     *
+     * @return The configuration.
+     */
+    @Configuration
+    public Option[] config() {
+        return options(
+
+            // Specify which version of Karaf to use.
+            karafDistributionConfiguration()
+                .frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz")
+                    .versionAsInProject())
+                .karafVersion(System.getProperty("karafVersion"))
+                .useDeployFolder(false)
+                .unpackDirectory(new File("target/paxexam/unpack")),
+
+            // Add JUnit bundles.
+            junitBundles(),
+
+            // Add the additional JRE exports that Ignite requires.
+            editConfigurationFileExtend("etc/jre.properties", "jre-1.7", "sun.nio.ch"),
+            editConfigurationFileExtend("etc/jre.properties", "jre-1.8", "sun.nio.ch"),
+
+            // Make log level INFO.
+            logLevel(LogLevelOption.LogLevel.INFO),
+
+            // Add our features repository.
+            features(mavenBundle()
+                        .groupId("org.apache.ignite").artifactId("ignite-osgi-karaf")
+                        .version(System.getProperty("projectVersion")).type("xml/features"),
+                "ignite-all"),
+
+            // Propagate the projectVersion system property.
+            systemProperty("projectVersion").value(System.getProperty("projectVersion"))
+        );
+    }
+
+    /**
+     * @throws Exception
+     */
+    @Test
+    public void testAllBundlesActiveAndFeaturesInstalled() throws Exception {
+        // Asssert all bundles except fragments are ACTIVE.
+        for (Bundle b : bundleCtx.getBundles()) {
+            System.out.println(String.format("Checking state of bundle [symbolicName=%s, state=%s]",
+                b.getSymbolicName(), b.getState()));
+
+            if (b.getHeaders().get(Constants.FRAGMENT_HOST) == null)
+                assertTrue(b.getState() == Bundle.ACTIVE);
+        }
+
+        // Check that according to the FeaturesService, all Ignite features except ignite-log4j are installed.
+        Feature[] features = featuresSvc.getFeatures(IGNITE_FEATURES_NAME_REGEX);
+
+        assertNotNull(features);
+        assertEquals(20, features.length);
+
+        for (Feature f : features) {
+            if (IGNORED_FEATURES.contains(f.getName()))
+                continue;
+
+            boolean installed = featuresSvc.isInstalled(f);
+
+            System.out.println(String.format("Checking if feature is installed [featureName=%s, installed=%s]",
+                f.getName(), installed));
+
+            assertTrue(installed);
+            assertEquals(PROJECT_VERSION.replaceAll("-", "."), f.getVersion());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/rest-http/pom.xml
----------------------------------------------------------------------
diff --git a/modules/rest-http/pom.xml b/modules/rest-http/pom.xml
index 9aa79f2..accfeda 100644
--- a/modules/rest-http/pom.xml
+++ b/modules/rest-http/pom.xml
@@ -34,6 +34,13 @@
     <version>1.5.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
+    <properties>
+        <osgi.export.package>
+            org.apache.ignite.internal.processors.rest.protocols.http.jetty,
+            {local-packages}
+        </osgi.export.package>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.ignite</groupId>
@@ -44,13 +51,13 @@
         <dependency>
             <groupId>org.apache.tomcat</groupId>
             <artifactId>tomcat-servlet-api</artifactId>
-            <version>8.0.23</version>
+            <version>${tomcat.version}</version>
         </dependency>
 
         <dependency>
             <groupId>commons-lang</groupId>
             <artifactId>commons-lang</artifactId>
-            <version>2.6</version>
+            <version>${commons.lang.version}</version>
         </dependency>
 
         <dependency>
@@ -92,38 +99,38 @@
         <dependency>
             <groupId>net.sf.json-lib</groupId>
             <artifactId>json-lib</artifactId>
-            <version>2.4</version>
+            <version>${jsonlib.version}</version>
             <classifier>jdk15</classifier>
         </dependency>
 
         <dependency>
             <groupId>net.sf.ezmorph</groupId>
             <artifactId>ezmorph</artifactId>
-            <version>1.0.6</version>
+            <version>${ezmorph.version}</version>
         </dependency>
 
         <dependency>
             <groupId>commons-collections</groupId>
             <artifactId>commons-collections</artifactId>
-            <version>3.2.1</version>
+            <version>${commons.collections.version}</version>
         </dependency>
 
         <dependency>
             <groupId>commons-beanutils</groupId>
             <artifactId>commons-beanutils</artifactId>
-            <version>1.8.3</version>
+            <version>${commons.beanutils.version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
-            <version>1.7.7</version>
+            <version>${slf4j.version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
-            <version>1.7.7</version>
+            <version>${slf4j.version}</version>
         </dependency>
 
         <dependency>
@@ -131,4 +138,15 @@
             <artifactId>log4j</artifactId>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/scalar-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar-2.10/pom.xml b/modules/scalar-2.10/pom.xml
index c2046e9..a76b73d 100644
--- a/modules/scalar-2.10/pom.xml
+++ b/modules/scalar-2.10/pom.xml
@@ -44,7 +44,7 @@
         <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>scala-library</artifactId>
-            <version>2.10.4</version>
+            <version>${scala210.library.version}</version>
         </dependency>
 
         <dependency>
@@ -109,6 +109,12 @@
                 <groupId>net.alchim31.maven</groupId>
                 <artifactId>scala-maven-plugin</artifactId>
             </plugin>
+
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
         </plugins>
 
         <!-- TODO IGNITE-956 FIX scaladocs plugins-->
@@ -194,5 +200,6 @@
                 <!--</executions>-->
             <!--</plugin>-->
         <!--</plugins>-->
+
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/scalar/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar/pom.xml b/modules/scalar/pom.xml
index 1443cc1..4948f9d 100644
--- a/modules/scalar/pom.xml
+++ b/modules/scalar/pom.xml
@@ -44,7 +44,7 @@
         <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>scala-library</artifactId>
-            <version>2.11.2</version>
+            <version>${scala211.library.version}</version>
         </dependency>
 
         <dependency>
@@ -184,6 +184,13 @@
                     </execution>
                 </executions>
             </plugin>
+
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+
         </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import/pom.xml b/modules/schema-import/pom.xml
index 1e63cae..0050d86 100644
--- a/modules/schema-import/pom.xml
+++ b/modules/schema-import/pom.xml
@@ -44,7 +44,7 @@
         <dependency>
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>
-            <version>1.3.175</version>
+            <version>${h2.version}</version>
             <scope>test</scope>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/slf4j/pom.xml
----------------------------------------------------------------------
diff --git a/modules/slf4j/pom.xml b/modules/slf4j/pom.xml
index b22ae6c..30118d4 100644
--- a/modules/slf4j/pom.xml
+++ b/modules/slf4j/pom.xml
@@ -44,7 +44,7 @@
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
-            <version>1.6.4</version>
+            <version>${slf4j.version}</version>
         </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/spark-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spark-2.10/pom.xml b/modules/spark-2.10/pom.xml
index 4697693..cf6a92b 100644
--- a/modules/spark-2.10/pom.xml
+++ b/modules/spark-2.10/pom.xml
@@ -52,7 +52,7 @@
         <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>scala-library</artifactId>
-            <version>2.10.4</version>
+            <version>${scala210.library.version}</version>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/spring/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spring/pom.xml b/modules/spring/pom.xml
index 8d1f918..0645c09 100644
--- a/modules/spring/pom.xml
+++ b/modules/spring/pom.xml
@@ -106,7 +106,7 @@
         <dependency>
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>
-            <version>1.3.175</version>
+            <version>${h2.version}</version>
             <scope>test</scope>
         </dependency>
 
@@ -118,11 +118,10 @@
             <scope>test</scope>
         </dependency>
 
-
         <dependency>
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>
-            <version>1.3.175</version>
+            <version>${h2.version}</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
@@ -136,5 +135,30 @@
                 </excludes>
             </testResource>
         </testResources>
+
+        <plugins>
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. 
+                 This bundle is a fragment attached to the ignite-core bundle, as it contains and exports classes in the org.apache.ignite
+                 leading to a split package situation in OSGi.
+            -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Fragment-Host>org.apache.ignite.ignite-core</Fragment-Host>
+                        <Require-Bundle>
+                            org.apache.servicemix.bundles.spring-beans,
+                            org.apache.servicemix.bundles.spring-context,
+                            org.apache.servicemix.bundles.spring-context-support,
+                            org.apache.servicemix.bundles.spring-core,
+                            org.apache.servicemix.bundles.spring-expression,
+                            org.apache.servicemix.bundles.spring-jdbc,
+                            org.apache.servicemix.bundles.spring-tx
+                        </Require-Bundle>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/ssh/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ssh/pom.xml b/modules/ssh/pom.xml
index 5028322..782c1e9 100644
--- a/modules/ssh/pom.xml
+++ b/modules/ssh/pom.xml
@@ -44,7 +44,7 @@
         <dependency>
             <groupId>com.jcraft</groupId>
             <artifactId>jsch</artifactId>
-            <version>0.1.53</version>
+            <version>${jsch.version}</version>
         </dependency>
 
         <dependency>
@@ -69,4 +69,21 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+            <!-- This is a fragment because it's an internal processor module. -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Fragment-Host>org.apache.ignite.ignite-core</Fragment-Host>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/urideploy/pom.xml
----------------------------------------------------------------------
diff --git a/modules/urideploy/pom.xml b/modules/urideploy/pom.xml
index c8fac6e..7bde657 100644
--- a/modules/urideploy/pom.xml
+++ b/modules/urideploy/pom.xml
@@ -80,19 +80,19 @@
         <dependency>
             <groupId>net.sf.jtidy</groupId>
             <artifactId>jtidy</artifactId>
-            <version>r938</version>
+            <version>${jtidy.version}</version>
         </dependency>
 
         <dependency>
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>
-            <version>1.6</version>
+            <version>${commons.codec.version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.tomcat</groupId>
             <artifactId>tomcat-servlet-api</artifactId>
-            <version>8.0.23</version>
+            <version>${tomcat.version}</version>
             <scope>test</scope>
         </dependency>
 
@@ -145,4 +145,15 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/visor-console-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console-2.10/pom.xml b/modules/visor-console-2.10/pom.xml
index 73c7a58..082cc84 100644
--- a/modules/visor-console-2.10/pom.xml
+++ b/modules/visor-console-2.10/pom.xml
@@ -80,13 +80,13 @@
         <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>scala-library</artifactId>
-            <version>2.10.4</version>
+            <version>${scala210.library.version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>jline</artifactId>
-            <version>2.10.4</version>
+            <version>${scala210.jline.version}</version>
         </dependency>
         <!-- Third party dependencies -->
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/visor-console/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console/pom.xml b/modules/visor-console/pom.xml
index b85cd69..9ec6c18 100644
--- a/modules/visor-console/pom.xml
+++ b/modules/visor-console/pom.xml
@@ -80,7 +80,7 @@
         <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>scala-library</artifactId>
-            <version>2.11.2</version>
+            <version>${scala211.library.version}</version>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/visor-plugins/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-plugins/pom.xml b/modules/visor-plugins/pom.xml
index 05b4ede..de31304 100644
--- a/modules/visor-plugins/pom.xml
+++ b/modules/visor-plugins/pom.xml
@@ -53,13 +53,13 @@
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
-            <version>1.7.7</version>
+            <version>${slf4j.version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
-            <version>1.7.7</version>
+            <version>${slf4j.version}</version>
         </dependency>
         <!-- Third party dependencies -->
     </dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/web/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web/pom.xml b/modules/web/pom.xml
index 99a356e..8880370 100644
--- a/modules/web/pom.xml
+++ b/modules/web/pom.xml
@@ -44,7 +44,7 @@
         <dependency>
             <groupId>org.apache.tomcat</groupId>
             <artifactId>tomcat-servlet-api</artifactId>
-            <version>8.0.23</version>
+            <version>${tomcat.version}</version>
         </dependency>
 
         <dependency>
@@ -89,4 +89,15 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+    
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/modules/zookeeper/pom.xml
----------------------------------------------------------------------
diff --git a/modules/zookeeper/pom.xml b/modules/zookeeper/pom.xml
index 303b941..1c2c2ec 100644
--- a/modules/zookeeper/pom.xml
+++ b/modules/zookeeper/pom.xml
@@ -34,10 +34,6 @@
     <version>1.5.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
-    <properties>
-        <curator.version>2.9.1</curator.version>
-    </properties>
-
     <dependencies>
         <dependency>
             <groupId>org.apache.ignite</groupId>
@@ -87,4 +83,14 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index cb7c533..4a9471f 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -35,15 +35,82 @@
 
     <properties>
         <ignite.edition>fabric</ignite.edition>
-        <hadoop.version>2.4.1</hadoop.version>
-        <spark.version>1.5.1</spark.version>
-        <spring.version>4.1.0.RELEASE</spring.version>
+
+        <!-- Build parameters. -->
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.build.timestamp.format>MMMM d yyyy</maven.build.timestamp.format>
         <doxygen.exec>doxygen</doxygen.exec>
         <git.exec>git</git.exec>
-        <jetty.version>9.2.11.v20150529</jetty.version>
+        <maven.bundle.plugin.version>2.5.4</maven.bundle.plugin.version>
         <javadoc.opts>-XDenableSunApiLintControl</javadoc.opts>
+
+        <!-- Dependency versions. -->
+        <activemq.version>5.12.0</activemq.version>
+        <aopalliance.bundle.version>1.0_6</aopalliance.bundle.version>
+        <asm.version>4.2</asm.version>
+        <aspectj.version>1.7.2</aspectj.version>
+        <aspectj.bundle.version>1.7.2_1</aspectj.bundle.version>
+        <aws.sdk.version>1.10.29</aws.sdk.version>
+        <aws.sdk.bundle.version>1.10.12_1</aws.sdk.bundle.version>
+        <commons.beanutils.version>1.8.3</commons.beanutils.version>
+        <commons.beanutils.bundle.version>1.8.3_1</commons.beanutils.bundle.version>
+        <commons.codec.version>1.6</commons.codec.version>
+        <commons.collections.version>3.2.1</commons.collections.version>
+        <commons.lang.version>2.6</commons.lang.version>
+        <curator.version>2.9.1</curator.version>
+        <ezmorph.version>1.0.6</ezmorph.version>
+        <ezmorph.bundle.version>1.0.6_1</ezmorph.bundle.version>
+        <guava.retrying.version>2.0.0</guava.retrying.version>
+        <guava.version>18.0</guava.version>
+        <guava16.version>16.0.1</guava16.version>
+        <h2.version>1.3.175</h2.version>
+        <hadoop.version>2.4.1</hadoop.version>
+        <httpclient.version>4.5.1</httpclient.version>
+        <httpcore.version>4.4.3</httpcore.version>
+        <jackson.version>1.9.13</jackson.version>
+        <javax.cache.version>1.0.0</javax.cache.version>
+        <javax.cache.bundle.version>1.0.0_1</javax.cache.bundle.version>
+        <jetty.version>9.2.11.v20150529</jetty.version>
+        <jms.spec.version>1.1.1</jms.spec.version>
+        <jsch.version>0.1.53</jsch.version>
+        <jsch.bundle.version>0.1.53_1</jsch.bundle.version>
+        <jsonlib.version>2.4</jsonlib.version>
+        <jsonlib.bundle.version>2.4_1</jsonlib.bundle.version>
+        <jtidy.version>r938</jtidy.version>
+        <kafka.version>0.8.2.1</kafka.version>
+        <kafka.bundle.version>0.8.2.1_1</kafka.bundle.version>
+        <kafka.clients.bundle.version>0.8.2.0_1</kafka.clients.bundle.version>
+        <kafka.clients.version>0.8.2.0</kafka.clients.version>
+        <kafka.version>0.8.2.1</kafka.version>
+        <karaf.version>4.0.2</karaf.version>
+        <lucene.version>3.5.0</lucene.version>
+        <lucene.bundle.version>3.5.0_1</lucene.bundle.version>
+        <oro.bundle.version>2.0.8_6</oro.bundle.version>
+        <osgi.core.version>5.0.0</osgi.core.version>
+        <osgi.enterprise.version>5.0.0</osgi.enterprise.version>
+        <paho.version>1.0.2</paho.version>
+        <scala210.library.version>2.10.4</scala210.library.version>
+        <scala210.jline.version>2.10.4</scala210.jline.version>
+        <scala211.library.version>2.11.2</scala211.library.version>
+        <slf4j16.version>1.6.4</slf4j16.version>
+        <slf4j.version>1.7.7</slf4j.version>
+        <spark.version>1.5.1</spark.version>
+        <spring41.osgi.feature.version>4.1.7.RELEASE_1</spring41.osgi.feature.version>
+        <spring.version>4.1.0.RELEASE</spring.version>
+        <tomcat.version>8.0.23</tomcat.version>
+        <yammer.metrics.annotation.version>2.2.0</yammer.metrics.annotation.version>
+        <yammer.metrics.core.version>2.2.0</yammer.metrics.core.version>
+        <zkclient.version>0.5</zkclient.version>
+        <zookeeper.version>3.4.6</zookeeper.version>
+
+        <!-- OSGI Manifest generation default property values -->
+        <osgi.import.package>*</osgi.import.package>
+        <osgi.export.package>{local-packages}</osgi.export.package>
+        <osgi.private.package></osgi.private.package>
+        <osgi.embed.dependency></osgi.embed.dependency>
+        <osgi.embed.transitive>false</osgi.embed.transitive>
+        <osgi.fail.ok>false</osgi.fail.ok>
+
     </properties>
 
     <groupId>org.apache.ignite</groupId>
@@ -182,6 +249,15 @@
                         </execution>
                     </executions>
                 </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <configuration>
+                        <useDefaultManifestFile>true</useDefaultManifestFile>
+                    </configuration>
+                </plugin>
+
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-javadoc-plugin</artifactId>
@@ -398,6 +474,52 @@
                         </bottom>
                     </configuration>
                 </plugin>
+
+                <plugin>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>maven-bundle-plugin</artifactId>
+                    <version>${maven.bundle.plugin.version}</version>
+                    <extensions>true</extensions>
+                    <configuration>
+                        <archive>
+                            <addMavenDescriptor>true</addMavenDescriptor>
+                        </archive>
+                        <supportedProjectTypes>
+                            <supportedProjectType>jar</supportedProjectType>
+                            <supportedProjectType>war</supportedProjectType>
+                        </supportedProjectTypes>
+                        <instructions>
+                            <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+                            <Bundle-Version>${project.version}</Bundle-Version>
+                            <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
+                            <Bundle-Description>${project.description}</Bundle-Description>
+                            <Bundle-DocURL>${project.url}</Bundle-DocURL>
+                            <Import-Package>
+                                ${osgi.import.package}
+                            </Import-Package>
+                            <Export-Package>
+                                ${osgi.export.package}
+                            </Export-Package>
+                            <Private-Package>
+                                ${osgi.private.package}
+                            </Private-Package>
+                            <Embed-Dependency>${osgi.embed.dependency}</Embed-Dependency>
+                            <Embed-Directory>lib</Embed-Directory>
+                            <Embed-Transitive>${osgi.embed.transitive}</Embed-Transitive>
+                            <_failok>${osgi.fail.ok}</_failok>
+                            <_invalidfilenames />
+                        </instructions>
+                    </configuration>
+                    <executions>
+                        <execution>
+                            <id>bundle-manifest</id>
+                            <phase>process-classes</phase>
+                            <goals>
+                                <goal>manifest</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
             </plugins>
         </pluginManagement>
 
@@ -621,6 +743,7 @@
                     </execution>
                 </executions>
             </plugin>
+
         </plugins>
     </build>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a80095/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1008981..ead4e50 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,6 +80,9 @@
         <module>modules/mqtt</module>
         <module>modules/zookeeper</module>
         <module>modules/camel</module>
+        <module>modules/osgi</module>
+        <module>modules/osgi-karaf</module>
+        <module>modules/osgi-paxlogging</module>
         <module>modules/platform</module>
     </modules>
 


Mime
View raw message