Return-Path: X-Original-To: apmail-felix-commits-archive@www.apache.org Delivered-To: apmail-felix-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 056F918C97 for ; Tue, 1 Dec 2015 12:35:07 +0000 (UTC) Received: (qmail 42888 invoked by uid 500); 1 Dec 2015 12:34:54 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 42848 invoked by uid 500); 1 Dec 2015 12:34:54 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 42839 invoked by uid 99); 1 Dec 2015 12:34:54 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Dec 2015 12:34:54 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id B25C31809C2 for ; Tue, 1 Dec 2015 12:34:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.246 X-Spam-Level: * X-Spam-Status: No, score=1.246 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.554] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id ijtuVdq_Ymue for ; Tue, 1 Dec 2015 12:34:38 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTP id 852492164D for ; Tue, 1 Dec 2015 12:34:38 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 80BC8E1037 for ; Tue, 1 Dec 2015 12:34:37 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 758DF3A05A2 for ; Tue, 1 Dec 2015 12:34:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r974141 [14/28] - in /websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST: ./ css/ images/ images/logos/ images/profiles/ img/ js/ xref-test/ xref-test/org/ xref-test/org/apache/ xref-test/org/apache/fel... Date: Tue, 01 Dec 2015 12:34:36 -0000 To: commits@felix.apache.org From: bimargulies@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151201123437.758DF3A05A2@svn01-us-west.apache.org> Propchange: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/BundlePlugin.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/BundlePlugin.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/DependencyEmbedder.html ============================================================================== --- websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/DependencyEmbedder.html (added) +++ websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/DependencyEmbedder.html Tue Dec 1 12:34:34 2015 @@ -0,0 +1,318 @@ + + + +DependencyEmbedder xref + + + +
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   *   http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.felix.bundleplugin;
+20  
+21  
+22  import java.io.File;
+23  import java.util.Collection;
+24  import java.util.Iterator;
+25  import java.util.LinkedHashSet;
+26  
+27  import org.apache.maven.artifact.Artifact;
+28  import org.apache.maven.plugin.MojoExecutionException;
+29  import org.apache.maven.plugin.logging.Log;
+30  import org.apache.maven.shared.dependency.graph.DependencyNode;
+31  import org.codehaus.plexus.util.StringUtils;
+32  
+33  import aQute.bnd.osgi.Analyzer;
+34  
+35  
+36  /**
+37   * Add BND directives to embed selected dependencies inside a bundle
+38   *
+39   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+40   */
+41  public final class DependencyEmbedder extends AbstractDependencyFilter
+42  {
+43      public static final String EMBED_DEPENDENCY = "Embed-Dependency";
+44      public static final String EMBED_DIRECTORY = "Embed-Directory";
+45      public static final String EMBED_STRIP_GROUP = "Embed-StripGroup";
+46      public static final String EMBED_STRIP_VERSION = "Embed-StripVersion";
+47      public static final String EMBED_TRANSITIVE = "Embed-Transitive";
+48  
+49      public static final String EMBEDDED_ARTIFACTS = "Embedded-Artifacts";
+50  
+51      private static final String MAVEN_DEPENDENCIES = "{maven-dependencies}";
+52  
+53      private String m_embedDirectory;
+54      private String m_embedStripGroup;
+55      private String m_embedStripVersion;
+56  
+57      /**
+58       * Inlined paths.
+59       */
+60      private final Collection<String> m_inlinedPaths;
+61  
+62      /**
+63       * Embedded artifacts.
+64       */
+65      private final Collection<Artifact> m_embeddedArtifacts;
+66  
+67  
+68      public DependencyEmbedder( Log log, DependencyNode dependencyGraph, Collection<Artifact> dependencyArtifacts )
+69      {
+70          super( dependencyGraph, dependencyArtifacts );
+71  
+72          m_inlinedPaths = new LinkedHashSet<String>();
+73          m_embeddedArtifacts = new LinkedHashSet<Artifact>();
+74      }
+75  
+76      public void processHeaders( Analyzer analyzer ) throws MojoExecutionException
+77      {
+78          StringBuffer includeResource = new StringBuffer();
+79          StringBuffer bundleClassPath = new StringBuffer();
+80          StringBuffer embeddedArtifacts = new StringBuffer();
+81  
+82          m_inlinedPaths.clear();
+83          m_embeddedArtifacts.clear();
+84  
+85          String embedDependencyHeader = analyzer.getProperty( EMBED_DEPENDENCY );
+86          if ( StringUtils.isNotEmpty( embedDependencyHeader ) )
+87          {
+88              m_embedDirectory = analyzer.getProperty( EMBED_DIRECTORY );
+89              m_embedStripGroup = analyzer.getProperty( EMBED_STRIP_GROUP, "true" );
+90              m_embedStripVersion = analyzer.getProperty( EMBED_STRIP_VERSION );
+91  
+92              processInstructions( embedDependencyHeader );
+93  
+94              for ( Iterator<String> i = m_inlinedPaths.iterator(); i.hasNext(); )
+95              {
+96                  inlineDependency( i.next(), includeResource );
+97              }
+98              for ( Iterator<Artifact> i = m_embeddedArtifacts.iterator(); i.hasNext(); )
+99              {
+100                 embedDependency( i.next(), includeResource, bundleClassPath, embeddedArtifacts );
+101             }
+102         }
+103 
+104         if ( analyzer.getProperty( Analyzer.WAB ) == null && bundleClassPath.length() > 0 )
+105         {
+106             // set explicit default before merging dependency classpath
+107             if ( analyzer.getProperty( Analyzer.BUNDLE_CLASSPATH ) == null )
+108             {
+109                 analyzer.setProperty( Analyzer.BUNDLE_CLASSPATH, "." );
+110             }
+111         }
+112 
+113         appendDependencies( analyzer, Analyzer.INCLUDE_RESOURCE, includeResource.toString() );
+114         appendDependencies( analyzer, Analyzer.BUNDLE_CLASSPATH, bundleClassPath.toString() );
+115         appendDependencies( analyzer, EMBEDDED_ARTIFACTS, embeddedArtifacts.toString() );
+116     }
+117 
+118 
+119     @Override
+120     protected void processDependencies( Collection<Artifact> dependencies, String inline )
+121     {
+122         if ( null == inline || "false".equalsIgnoreCase( inline ) )
+123         {
+124             m_embeddedArtifacts.addAll( dependencies );
+125         }
+126         else
+127         {
+128             for ( Iterator<Artifact> i = dependencies.iterator(); i.hasNext(); )
+129             {
+130                 addInlinedPaths( i.next(), inline, m_inlinedPaths );
+131             }
+132         }
+133     }
+134 
+135 
+136     private static void addInlinedPaths( Artifact dependency, String inline, Collection<String> inlinedPaths )
+137     {
+138         File path = dependency.getFile();
+139         if ( null != path && path.exists() )
+140         {
+141             if ( "true".equalsIgnoreCase( inline ) || inline.length() == 0 )
+142             {
+143                 inlinedPaths.add( path.getPath() );
+144             }
+145             else
+146             {
+147                 String[] filters = inline.split( "\\|" );
+148                 for ( int i = 0; i < filters.length; i++ )
+149                 {
+150                     if ( filters[i].length() > 0 )
+151                     {
+152                         inlinedPaths.add( path + "!/" + filters[i] );
+153                     }
+154                 }
+155             }
+156         }
+157     }
+158 
+159 
+160     private void embedDependency( Artifact dependency, StringBuffer includeResource, StringBuffer bundleClassPath,
+161         StringBuffer embeddedArtifacts )
+162     {
+163         File sourceFile = dependency.getFile();
+164         if ( null != sourceFile && sourceFile.exists() )
+165         {
+166             String embedDirectory = m_embedDirectory;
+167             if ( "".equals( embedDirectory ) || ".".equals( embedDirectory ) )
+168             {
+169                 embedDirectory = null;
+170             }
+171 
+172             if ( false == Boolean.valueOf( m_embedStripGroup ).booleanValue() )
+173             {
+174                 embedDirectory = new File( embedDirectory, dependency.getGroupId() ).getPath();
+175             }
+176 
+177             StringBuffer targetFileName = new StringBuffer();
+178             targetFileName.append( dependency.getArtifactId() );
+179             if ( false == Boolean.valueOf( m_embedStripVersion ).booleanValue() )
+180             {
+181                 targetFileName.append( '-' ).append( dependency.getVersion() );
+182                 if ( StringUtils.isNotEmpty( dependency.getClassifier() ) )
+183                 {
+184                     targetFileName.append( '-' ).append( dependency.getClassifier() );
+185                 }
+186             }
+187             String extension = dependency.getArtifactHandler().getExtension();
+188             if ( StringUtils.isNotEmpty( extension ) )
+189             {
+190                 targetFileName.append( '.' ).append( extension );
+191             }
+192 
+193             File targetFile = new File( embedDirectory, targetFileName.toString() );
+194 
+195             String targetFilePath = targetFile.getPath();
+196 
+197             // replace windows backslash with a slash
+198             if ( File.separatorChar != '/' )
+199             {
+200                 targetFilePath = targetFilePath.replace( File.separatorChar, '/' );
+201             }
+202 
+203             if ( includeResource.length() > 0 )
+204             {
+205                 includeResource.append( ',' );
+206             }
+207 
+208             includeResource.append( targetFilePath );
+209             includeResource.append( '=' );
+210             includeResource.append( sourceFile );
+211 
+212             if ( bundleClassPath.length() > 0 )
+213             {
+214                 bundleClassPath.append( ',' );
+215             }
+216 
+217             bundleClassPath.append( targetFilePath );
+218 
+219             if ( embeddedArtifacts.length() > 0 )
+220             {
+221                 embeddedArtifacts.append( ',' );
+222             }
+223 
+224             embeddedArtifacts.append( targetFilePath ).append( ';' );
+225             embeddedArtifacts.append( "g=\"" ).append( dependency.getGroupId() ).append( '"' );
+226             embeddedArtifacts.append( ";a=\"" ).append( dependency.getArtifactId() ).append( '"' );
+227             embeddedArtifacts.append( ";v=\"" ).append( dependency.getBaseVersion() ).append( '"' );
+228             if ( StringUtils.isNotEmpty( dependency.getClassifier() ) )
+229             {
+230                 embeddedArtifacts.append( ";c=\"" ).append( dependency.getClassifier() ).append( '"' );
+231             }
+232         }
+233     }
+234 
+235 
+236     private static void inlineDependency( String path, StringBuffer includeResource )
+237     {
+238         if ( includeResource.length() > 0 )
+239         {
+240             includeResource.append( ',' );
+241         }
+242 
+243         includeResource.append( '@' );
+244         includeResource.append( path );
+245     }
+246 
+247 
+248     public Collection<String> getInlinedPaths()
+249     {
+250         return m_inlinedPaths;
+251     }
+252 
+253 
+254     public Collection<Artifact> getEmbeddedArtifacts()
+255     {
+256         return m_embeddedArtifacts;
+257     }
+258 
+259 
+260     private static void appendDependencies( Analyzer analyzer, String directiveName, String mavenDependencies )
+261     {
+262         /*
+263          * similar algorithm to {maven-resources} but default behaviour here is to append rather than override
+264          */
+265         final String instruction = analyzer.getProperty( directiveName );
+266         if ( StringUtils.isNotEmpty( instruction ) )
+267         {
+268             if ( instruction.indexOf( MAVEN_DEPENDENCIES ) >= 0 )
+269             {
+270                 // if there are no embeddded dependencies, we do a special treatment and replace
+271                 // every occurance of MAVEN_DEPENDENCIES and a following comma with an empty string
+272                 if ( mavenDependencies.length() == 0 )
+273                 {
+274                     String cleanInstruction = BundlePlugin.removeTagFromInstruction( instruction, MAVEN_DEPENDENCIES );
+275                     analyzer.setProperty( directiveName, cleanInstruction );
+276                 }
+277                 else
+278                 {
+279                     String mergedInstruction = StringUtils.replace( instruction, MAVEN_DEPENDENCIES, mavenDependencies );
+280                     analyzer.setProperty( directiveName, mergedInstruction );
+281                 }
+282             }
+283             else if ( mavenDependencies.length() > 0 )
+284             {
+285                 if ( Analyzer.INCLUDE_RESOURCE.equalsIgnoreCase( directiveName ) )
+286                 {
+287                     // dependencies should be prepended so they can be overwritten by local resources
+288                     analyzer.setProperty( directiveName, mavenDependencies + ',' + instruction );
+289                 }
+290                 else
+291                 // Analyzer.BUNDLE_CLASSPATH
+292                 {
+293                     // for the classpath we want dependencies to be appended after local entries
+294                     analyzer.setProperty( directiveName, instruction + ',' + mavenDependencies );
+295                 }
+296             }
+297             // otherwise leave instruction unchanged
+298         }
+299         else if ( mavenDependencies.length() > 0 )
+300         {
+301             analyzer.setProperty( directiveName, mavenDependencies );
+302         }
+303         // otherwise leave instruction unchanged
+304     }
+305 }
+
+
+ + + \ No newline at end of file Propchange: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/DependencyEmbedder.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/DependencyEmbedder.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/DependencyExcluder.html ============================================================================== --- websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/DependencyExcluder.html (added) +++ websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/DependencyExcluder.html Tue Dec 1 12:34:34 2015 @@ -0,0 +1,86 @@ + + + +DependencyExcluder xref + + + +
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   *   http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.felix.bundleplugin;
+20  
+21  
+22  import java.util.Collection;
+23  import java.util.HashSet;
+24  
+25  import org.apache.maven.artifact.Artifact;
+26  import org.apache.maven.plugin.MojoExecutionException;
+27  import org.apache.maven.shared.dependency.graph.DependencyNode;
+28  
+29  
+30  /**
+31   * Exclude selected dependencies from the classpath passed to BND.
+32   *
+33   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+34   */
+35  public final class DependencyExcluder extends AbstractDependencyFilter
+36  {
+37      /**
+38       * Excluded artifacts.
+39       */
+40      private final Collection<Artifact> m_excludedArtifacts;
+41  
+42  
+43      public DependencyExcluder( DependencyNode dependencyGraph, Collection<Artifact> dependencyArtifacts )
+44      {
+45          super( dependencyGraph, dependencyArtifacts );
+46  
+47          m_excludedArtifacts = new HashSet<Artifact>();
+48      }
+49  
+50  
+51      public void processHeaders( String excludeDependencies ) throws MojoExecutionException
+52      {
+53          m_excludedArtifacts.clear();
+54  
+55          if ( null != excludeDependencies && excludeDependencies.length() > 0 )
+56          {
+57              processInstructions( excludeDependencies );
+58          }
+59      }
+60  
+61  
+62      @Override
+63      protected void processDependencies( Collection<Artifact> dependencies, String inline )
+64      {
+65          m_excludedArtifacts.addAll( dependencies );
+66      }
+67  
+68  
+69      public Collection<Artifact> getExcludedArtifacts()
+70      {
+71          return m_excludedArtifacts;
+72      }
+73  }
+
+
+ + + \ No newline at end of file Propchange: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/DependencyExcluder.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/DependencyExcluder.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/InstructionsPlugin.html ============================================================================== --- websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/InstructionsPlugin.html (added) +++ websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/InstructionsPlugin.html Tue Dec 1 12:34:34 2015 @@ -0,0 +1,89 @@ + + + +InstructionsPlugin xref + + + +
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   *   http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.felix.bundleplugin;
+20  
+21  
+22  import java.io.File;
+23  import java.io.FileNotFoundException;
+24  import java.io.IOException;
+25  import java.util.Map;
+26  import java.util.Properties;
+27  
+28  import org.apache.maven.plugin.MojoExecutionException;
+29  import org.apache.maven.plugin.MojoFailureException;
+30  import org.apache.maven.plugins.annotations.Mojo;
+31  import org.apache.maven.plugins.annotations.ResolutionScope;
+32  import org.apache.maven.project.MavenProject;
+33  
+34  import aQute.bnd.osgi.Jar;
+35  import org.apache.maven.shared.dependency.graph.DependencyNode;
+36  
+37  
+38  /**
+39   * Generate BND instructions for this project
+40   */
+41  @Mojo( name = "instructions", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true  )
+42  public class InstructionsPlugin extends BundlePlugin
+43  {
+44      @Override
+45      protected void execute( MavenProject project, DependencyNode dependencyGraph, Map<String, String> instructions, Properties properties, Jar[] classpath )
+46          throws MojoExecutionException
+47      {
+48          if ( dumpInstructions == null )
+49          {
+50              dumpInstructions = new File( getBuildDirectory(), "instructions.bnd" );
+51          }
+52  
+53          try
+54          {
+55              addMavenInstructions( project, dependencyGraph, getOSGiBuilder(project, instructions, properties, classpath) );
+56          }
+57          catch ( FileNotFoundException e )
+58          {
+59              throw new MojoExecutionException( "Cannot find " + e.getMessage(), e );
+60          }
+61          catch ( IOException e )
+62          {
+63              throw new MojoExecutionException( "Error trying to generate instructions", e );
+64          }
+65          catch ( MojoFailureException e )
+66          {
+67              getLog().error( e.getLocalizedMessage() );
+68              throw new MojoExecutionException( "Error(s) found in instructions", e );
+69          }
+70          catch ( Exception e )
+71          {
+72              getLog().error( "An internal error occurred", e );
+73              throw new MojoExecutionException( "Internal error in maven-bundle-plugin", e );
+74          }
+75      }
+76  }
+
+
+ + + \ No newline at end of file Propchange: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/InstructionsPlugin.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/InstructionsPlugin.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/JarPluginConfiguration.html ============================================================================== --- websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/JarPluginConfiguration.html (added) +++ websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/JarPluginConfiguration.html Tue Dec 1 12:34:34 2015 @@ -0,0 +1,107 @@ + + + +JarPluginConfiguration xref + + + +
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   *   http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.felix.bundleplugin;
+20  
+21  
+22  import org.apache.maven.archiver.MavenArchiveConfiguration;
+23  import org.apache.maven.project.MavenProject;
+24  import org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter;
+25  import org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup;
+26  import org.codehaus.plexus.component.configurator.converters.lookup.DefaultConverterLookup;
+27  import org.codehaus.plexus.component.configurator.expression.DefaultExpressionEvaluator;
+28  import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
+29  import org.codehaus.plexus.configuration.PlexusConfiguration;
+30  import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
+31  import org.codehaus.plexus.util.xml.Xpp3Dom;
+32  
+33  
+34  /**
+35   * Provide access to the archive configuration from the jar plugin
+36   * 
+37   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+38   */
+39  public final class JarPluginConfiguration
+40  {
+41      public static MavenArchiveConfiguration getArchiveConfiguration( MavenProject project )
+42      {
+43          MavenArchiveConfiguration archiveConfig = new MavenArchiveConfiguration();
+44  
+45          try
+46          {
+47              ObjectWithFieldsConverter converter = new ObjectWithFieldsConverter();
+48              ClassLoader loader = JarPluginConfiguration.class.getClassLoader();
+49              ExpressionEvaluator evaluator = new DefaultExpressionEvaluator();
+50              ConverterLookup converters = new DefaultConverterLookup();
+51  
+52              PlexusConfiguration settings = null;
+53  
+54              try
+55              {
+56                  // first look for bundle specific archive settings
+57                  settings = getPluginConfiguration( project, "org.apache.felix", "maven-bundle-plugin" );
+58                  settings = settings.getChild( "archive" );
+59              }
+60              catch ( Exception e )
+61              {
+62              }
+63  
+64              // if it's empty fall back to the jar archive settings
+65              if ( null == settings || settings.getChildCount() == 0 )
+66              {
+67                  settings = getCorePluginConfiguration( project, "jar" );
+68                  settings = settings.getChild( "archive" );
+69              }
+70  
+71              converter.processConfiguration( converters, archiveConfig, loader, settings, evaluator, null );
+72          }
+73          catch ( Exception e )
+74          {
+75              // ignore and return empty configuration...
+76          }
+77  
+78          return archiveConfig;
+79      }
+80  
+81  
+82      private static PlexusConfiguration getCorePluginConfiguration( MavenProject project, String pluginName )
+83      {
+84          return getPluginConfiguration( project, "org.apache.maven.plugins", "maven-" + pluginName + "-plugin" );
+85      }
+86  
+87  
+88      private static PlexusConfiguration getPluginConfiguration( MavenProject project, String groupId, String artifactId )
+89      {
+90          Xpp3Dom pluginConfig = project.getGoalConfiguration( groupId, artifactId, null, null );
+91  
+92          return new XmlPlexusConfiguration( pluginConfig );
+93      }
+94  }
+
+
+ + + \ No newline at end of file Propchange: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/JarPluginConfiguration.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/felix/content/components/bundle-plugin-archives/bundle-plugin-LATEST/xref/org/apache/felix/bundleplugin/JarPluginConfiguration.html ------------------------------------------------------------------------------ svn:mime-type = text/html