View Javadoc

1   package com.atlassian.plugin.osgi.factory.transform.stage;
2   
3   import com.atlassian.plugin.osgi.factory.transform.PluginTransformationException;
4   import com.atlassian.plugin.osgi.factory.transform.TransformContext;
5   import com.atlassian.plugin.osgi.factory.transform.TransformStage;
6   
7   import java.util.jar.JarEntry;
8   
9   /**
10   * The stages which scan for inner jars in attempt to create bundle classpath.
11   *
12   * @since 2.6.0
13   */
14  public class ScanInnerJarsStage implements TransformStage
15  {
16      protected static final String INNER_JARS_BASE_LOCATION = "META-INF/lib/";
17  
18      public void execute(TransformContext context) throws PluginTransformationException
19      {
20          for (final JarEntry jarEntry : context.getPluginJarEntries())
21          {
22              // we only want jar files under the defined base location.
23              if (jarEntry.getName().startsWith(INNER_JARS_BASE_LOCATION)
24                  && jarEntry.getName().endsWith(".jar"))
25              {
26                  context.addBundleClasspathJar(jarEntry.getName());
27              }
28          }
29      }
30  }