[RPM (6.0)] [DIST generic] ops4j-pax-swissbox-1.5.1-1.jpp6

Ralph Apel <[email protected]> Thu, 20 Sep 2012 23:02:49 +0200
Newsgroups gmane.linux.jpackage.announce
Message-ID <[email protected]>
Name        : ops4j-pax-swissbox           Relocations: (not relocatable)
Version     : 1.5.1                             Vendor: JPackage Project
Release     : 1.jpp6                        Build Date: Thu 20 Sep 2012 10:58:46 PM CEST
Install Date: (not installed)               Build Host: linux.fritz.box
Group       : Development/Libraries         Source RPM: (none)
Size        : 86501                            License: Apache 2.0 License
Signature   : (none)
Packager    : Ralph Apel <[email protected]>
URL         : http://wiki.ops4j.org/display/PAXSB/Pax+Swissbox
Summary     : Pax OSGi swissbox
Description :
Pax Swissbox is a set of utilities targeting OSGi and the
project emerged as means for re-usage within Pax projects.
But, as Pax Swissbox artifacts are generic, they can be
reused outside Pax projects.
In order to minimize dependencies and improve modularity Pax
Swissbox is split in very fine grained bundles that you can
use individually. Pax Swissbox artifacts are meant to be
embedded (wrapped) in your bundle (easy to achieve using
Maven Bundle Plugin) but you can use them as standalone
bundles.

---------------
Ralph Apel <r.apel at r-apel.de> 0:1.5.1-1
- 1.5.1
---------------
ops4j-pax-swissbox.src: W: source-or-patch-not-bzipped ops4j-pax-swissbox-pom.patch
ops4j-pax-swissbox.src: W: source-or-patch-not-bzipped ops4j-pax-swissbox-BndUtils.patch
ops4j-pax-swissbox.src: W: source-or-patch-not-bzipped ops4j-pax-swissbox-1.5.1.tgz
ops4j-pax-swissbox.src: W: no-signature
ops4j-pax-swissbox.src: W: invalid-license Apache 2.0 License
1 packages and 0 specfiles checked; 0 errors, 5 warnings.

---------------
Index: ops4j-pax-swissbox-BndUtils.patch
===================================================================
RCS file: /home/projects/jpackage/cvs/rpms/free/ops4j-pax-swissbox/ops4j-pax-swissbox-BndUtils.patch,v
retrieving revision 1.1
diff -u -r1.1 ops4j-pax-swissbox-BndUtils.patch
--- ops4j-pax-swissbox-BndUtils.patch	6 Feb 2012 08:23:54 -0000	1.1
+++ ops4j-pax-swissbox-BndUtils.patch	20 Sep 2012 21:02:47 -0000
@@ -1,40 +1,345 @@
---- pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java.sav3	2010-05-04 09:42:41.000000000 +0200
-+++ pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java	2012-02-05 21:51:42.561900738 +0100
-@@ -111,7 +111,10 @@
-         LOG.trace( "Using instructions " + instructions );
- 
-         final Jar jar = new Jar( "dot", jarInputStream );
--        final Manifest manifest = jar.getManifest();
+--- pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java.sav3	2012-06-25 19:45:40.000000000 +0200
++++ pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java	2012-09-19 17:02:11.515345840 +0200
+@@ -1 +1,340 @@
+-/*
 * Copyright 2008 Alin Dreghiciu.
 * Copyright 2008 Peter Kriens.
 *
 * Licensed  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.ops4j.pax.swissbox.bnd;

import java.io.IOException;
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.jar.Manifest;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.ops4j.lang.NullArgumentException;
import org.ops4j.lang.Ops4jException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import aQute.lib.osgi.Analyzer;
import aQute.lib.osgi.Constants;
import aQute.lib.osgi.Jar;

/**
 * Wrapper over PeterK's bnd lib.
 *
 * @author Alin Dreghiciu
 * @since 0.1.0, January 14, 2008
 */
public class BndUtils
{

    /**
     * Logger.
     */
    private static final Logger LOG = LoggerFactory.getLogger( BndUtils.class );

    /**
     * Regex pattern for matching instructions when specified in url.
     */
    private static final Pattern INSTRUCTIONS_PATTERN =
    	Pattern.compile("([a-zA-Z_0-9-]+)=([\\-!\"'()\\[\\]*+,.0-9A-Z_a-z%;:=/\\s]+)" ); //added [] and whitespace \s
    
    private static final Pattern CAMELCASE_PATTERN = 
    	Pattern.compile( "/\\b([A-Z][a-z]*){2,}\\b/");

    /**
     * Utility class. Ment to be used using static methods
     */
    private BndUtils()
    {
        // utility class
    }

    /**
     * Processes the input jar and generates the necessary OSGi headers using specified instructions.
     *
     * @param jarInputStream input stream for the jar to be processed. Cannot be null.
     * @param instructions   bnd specific processing instructions. Cannot be null.
     * @param jarInfo        information about the jar to be processed. Usually the jar url. Cannot be null or empty.
     *
     * @return an input stream for the generated bundle
     *
     * @throws NullArgumentException if any of the parameters is null
     * @throws IOException           re-thron during jar processing
     */
    public static InputStream createBundle( final InputStream jarInputStream,
                                            final Properties instructions,
                                            final String jarInfo )
        throws IOException
    {
        return createBundle( jarInputStream, instructions, jarInfo, OverwriteMode.KEEP );
    }

    /**
     * Processes the input jar and generates the necessary OSGi headers using specified instructions.
     *
     * @param jarInputStream input stream for the jar to be processed. Cannot be null.
     * @param instructions   bnd specific processing instructions. Cannot be null.
     * @param jarInfo        information about the jar to be processed. Usually the jar url. Cannot be null or empty.
     * @param overwriteMode  manifets overwrite mode
     *
     * @return an input stream for the generated bundle
     *
     * @throws NullArgumentException if any of the parameters is null
     * @throws IOException           re-thron during jar processing
     */
    public static InputStream createBundle( final InputStream jarInputStream,
                                            final Properties instructions,
                                            final String jarInfo,
                                            final OverwriteMode overwriteMode )
        throws IOException
    {
        NullArgumentException.validateNotNull( jarInputStream, "Jar URL" );
        NullArgumentException.validateNotNull( instructions, "Instructions" );
        NullArgumentException.validateNotEmpty( jarInfo, "Jar info" );

        LOG.debug( "Creating bundle for [" + jarInfo + "]" );
        LOG.debug( "Overwrite mode: " + overwriteMode );
        LOG.trace( "Using instructions " + instructions );

        final Jar jar = new Jar( "dot", jarInputStream );
        final Manifest manifest = jar.getManifest();

        // Make the jar a bundle if it is not already a bundle
        if( manifest == null
            || OverwriteMode.KEEP != overwriteMode
            || ( manifest.getMainAttributes().getValue( Analyzer.EXPORT_PACKAGE ) == null
                 && manifest.getMainAttributes().getValue( Analyzer.IMPORT_PACKAGE ) == null )
            )
        {
            // Do not use instructions as default for properties because it looks like BND uses the props
            // via some other means then getProperty() and so the instructions will not be used at all
            // So, just copy instructions to properties
            final Properties properties = new Properties();
            properties.putAll( instructions );

            properties.put( "Generated-By-Ops4j-Pax-From", jarInfo );

            final Analyzer analyzer = new Analyzer();
            analyzer.setJar( jar );
            analyzer.setProperties( properties );
            if( manifest != null && OverwriteMode.MERGE == overwriteMode )
            {
                analyzer.mergeManifest( manifest );
            }
            checkMandatoryProperties( analyzer, jar, jarInfo );
            try
            {
                analyzer.calcManifest();
            }
            catch ( Exception e )
            {
                throw new Ops4jException( e );
            }
        }

        return createInputStream( jar );
    }

    /**
     * Creates an piped input stream for the wrapped jar.
     * This is done in a thread so we can return quickly.
     *
     * @param jar the wrapped jar
     *
     * @return an input stream for the wrapped jar
     *
     * @throws java.io.IOException re-thrown
     */
    private static PipedInputStream createInputStream( final Jar jar )
        throws IOException
    {
        final PipedInputStream pin = new PipedInputStream();
        final PipedOutputStream pout = new PipedOutputStream( pin );

        new Thread()
        {
            public void run()
            {
                try
                {
                    jar.write( pout );
                }
                catch( IOException e )
                {
                    LOG.warn( "Bundle cannot be generated" );
                }
                finally
                {
                    try
                    {
                        jar.close();
                        pout.close();
                    }
                    catch( IOException ignore )
                    {
                        // if we get here something is very wrong
                        LOG.error( "Bundle cannot be generated", ignore );
                    }
                }
            }
        }.start();

        return pin;
    }

    /**
     * Check if manadatory properties are present, otherwise generate default.
     *
     * @param analyzer     bnd analyzer
     * @param jar          bnd jar
     * @param symbolicName bundle symbolic name
     */
    private static void checkMandatoryProperties( final Analyzer analyzer,
                                                  final Jar jar,
                                                  final String symbolicName )
    {
        final String importPackage = analyzer.getProperty( Analyzer.IMPORT_PACKAGE );
        if( importPackage == null || importPackage.trim().length() == 0 )
        {
            analyzer.setProperty( Analyzer.IMPORT_PACKAGE, "*;resolution:=optional" );
        }
        final String exportPackage = analyzer.getProperty( Analyzer.EXPORT_PACKAGE );
        if( exportPackage == null || exportPackage.trim().length() == 0 )
        {
            analyzer.setProperty( Analyzer.EXPORT_PACKAGE, analyzer.calculateExportsFromContents( jar ) );
        }
        final String localSymbolicName = analyzer.getProperty( Analyzer.BUNDLE_SYMBOLICNAME, symbolicName );
        analyzer.setProperty( Analyzer.BUNDLE_SYMBOLICNAME, generateSymbolicName( localSymbolicName ) );
    }

    /**
     * Processes symbolic name and replaces osgi spec invalid characters with "_".
     *
     * @param symbolicName bundle symbolic name
     *
     * @return a valid symbolic name
     */
    private static String generateSymbolicName( final String symbolicName )
    {
        return symbolicName.replaceAll( "[^a-zA-Z_0-9.-]", "_" );
    }

    /**
     * Parses bnd instructions out of an url query string.
     *
     * @param query query part of an url.
     *
     * @return parsed instructions as properties
     *
     * @throws java.net.MalformedURLException if provided path does not comply to syntax.
     */
    public static Properties parseInstructions( final String query )
        throws MalformedURLException
    {
        final Properties instructions = new Properties();
        if( query != null )
        {
            try
            {
                // just ignore for the moment and try out if we have valid properties separated by "&"
                final String segments[] = query.split( "&" );
                for( String segment : segments )
                {
                    // do not parse empty strings
                    if( segment.trim().length() > 0 )
                    {
                        final Matcher matcher = INSTRUCTIONS_PATTERN.matcher( segment );
                        if( matcher.matches() )
                        {
                            instructions.setProperty(
                                verifyKey(matcher.group( 1 )),
                                URLDecoder.decode( matcher.group( 2 ), "UTF-8" )
                            );
                        }
                        else
                        {
                            throw new MalformedURLException( "Invalid syntax for instruction [" + segment
                                                             + "]. Take a look at http://www.aqute.biz/Code/Bnd."
                            );
                        }
                    }
                }
            }
            catch( UnsupportedEncodingException e )
            {
                // thrown by URLDecoder but it should never happen
                throwAsMalformedURLException( "Could not retrieve the instructions from [" + query + "]", e );
            }
        }
        return instructions;
    }

    private static String verifyKey(String key) {
		List<String> list = new ArrayList<String>(Arrays.asList(Constants.headers));
		//patch the header list for an additional Web-ContextPath
		list.add("Web-ContextPath");
		if (list.contains(key)) {
			return key;
    	} else {
			//this is not a key contained in the headers list
			//either a specialized Camel-Case
			//which is forwarded
			if (CAMELCASE_PATTERN.matcher(key).matches()) { 
				return key;
    		} else {
				//no Camel Case check if it exists in list 
    			for (String header : list) {
					if (header.equalsIgnoreCase(key)) {
						return header;
					}
				}
    			return key;
			}
		}
	}

	/**
     * Creates an MalformedURLException with a message and a cause.
     *
     * @param message exception message
     * @param cause   exception cause
     *
     * @throws MalformedURLException the created MalformedURLException
     */
    private static void throwAsMalformedURLException( final String message, final Exception cause )
        throws MalformedURLException
    {
        final MalformedURLException exception = new MalformedURLException( message );
        exception.initCause( cause );
        throw exception;
    }

}
+\ No newline at end of file
++/*
++ * Copyright 2008 Alin Dreghiciu.
++ * Copyright 2008 Peter Kriens.
++ *
++ * Licensed  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.ops4j.pax.swissbox.bnd;
++
++import java.io.IOException;
++import java.io.InputStream;
++import java.io.PipedInputStream;
++import java.io.PipedOutputStream;
++import java.io.UnsupportedEncodingException;
++import java.net.MalformedURLException;
++import java.net.URLDecoder;
++import java.util.ArrayList;
++import java.util.Arrays;
++import java.util.List;
++import java.util.Properties;
++import java.util.jar.Manifest;
++import java.util.regex.Matcher;
++import java.util.regex.Pattern;
++
++import org.ops4j.lang.NullArgumentException;
++import org.ops4j.lang.Ops4jException;
++import org.slf4j.Logger;
++import org.slf4j.LoggerFactory;
++
++import aQute.lib.osgi.Analyzer;
++import aQute.lib.osgi.Constants;
++import aQute.lib.osgi.Jar;
++
++/**
++ * Wrapper over PeterK's bnd lib.
++ *
++ * @author Alin Dreghiciu
++ * @since 0.1.0, January 14, 2008
++ */
++public class BndUtils
++{
++
++    /**
++     * Logger.
++     */
++    private static final Logger LOG = LoggerFactory.getLogger( BndUtils.class );
++
++    /**
++     * Regex pattern for matching instructions when specified in url.
++     */
++    private static final Pattern INSTRUCTIONS_PATTERN =
++    	Pattern.compile("([a-zA-Z_0-9-]+)=([\\-!\"'()\\[\\]*+,.0-9A-Z_a-z%;:=/\\s]+)" ); //added [] and whitespace \s
++    
++    private static final Pattern CAMELCASE_PATTERN = 
++    	Pattern.compile( "/\\b([A-Z][a-z]*){2,}\\b/");
++
++    /**
++     * Utility class. Ment to be used using static methods
++     */
++    private BndUtils()
++    {
++        // utility class
++    }
++
++    /**
++     * Processes the input jar and generates the necessary OSGi headers using specified instructions.
++     *
++     * @param jarInputStream input stream for the jar to be processed. Cannot be null.
++     * @param instructions   bnd specific processing instructions. Cannot be null.
++     * @param jarInfo        information about the jar to be processed. Usually the jar url. Cannot be null or empty.
++     *
++     * @return an input stream for the generated bundle
++     *
++     * @throws NullArgumentException if any of the parameters is null
++     * @throws IOException           re-thron during jar processing
++     */
++    public static InputStream createBundle( final InputStream jarInputStream,
++                                            final Properties instructions,
++                                            final String jarInfo )
++        throws IOException
++    {
++        return createBundle( jarInputStream, instructions, jarInfo, OverwriteMode.KEEP );
++    }
++
++    /**
++     * Processes the input jar and generates the necessary OSGi headers using specified instructions.
++     *
++     * @param jarInputStream input stream for the jar to be processed. Cannot be null.
++     * @param instructions   bnd specific processing instructions. Cannot be null.
++     * @param jarInfo        information about the jar to be processed. Usually the jar url. Cannot be null or empty.
++     * @param overwriteMode  manifets overwrite mode
++     *
++     * @return an input stream for the generated bundle
++     *
++     * @throws NullArgumentException if any of the parameters is null
++     * @throws IOException           re-thron during jar processing
++     */
++    public static InputStream createBundle( final InputStream jarInputStream,
++                                            final Properties instructions,
++                                            final String jarInfo,
++                                            final OverwriteMode overwriteMode )
++        throws IOException
++    {
++        NullArgumentException.validateNotNull( jarInputStream, "Jar URL" );
++        NullArgumentException.validateNotNull( instructions, "Instructions" );
++        NullArgumentException.validateNotEmpty( jarInfo, "Jar info" );
++
++        LOG.debug( "Creating bundle for [" + jarInfo + "]" );
++        LOG.debug( "Overwrite mode: " + overwriteMode );
++        LOG.trace( "Using instructions " + instructions );
++
++        final Jar jar = new Jar( "dot", jarInputStream );
 +        Manifest manifest = null;
-+	try {
-+        	manifest = jar.getManifest();
-+	} catch(Exception e) {}
- 
-         // Make the jar a bundle if it is not already a bundle
-         if( manifest == null
-@@ -136,7 +139,9 @@
-                 analyzer.mergeManifest( manifest );
-             }
-             checkMandatoryProperties( analyzer, jar, jarInfo );
--            analyzer.calcManifest();
-+	    try {
++        try {
++            manifest = jar.getManifest();
++        } catch(Exception e) {
++        }
++
++        // Make the jar a bundle if it is not already a bundle
++        if( manifest == null
++            || OverwriteMode.KEEP != overwriteMode
++            || ( manifest.getMainAttributes().getValue( Analyzer.EXPORT_PACKAGE ) == null
++                 && manifest.getMainAttributes().getValue( Analyzer.IMPORT_PACKAGE ) == null )
++            )
++        {
++            // Do not use instructions as default for properties because it looks like BND uses the props
++            // via some other means then getProperty() and so the instructions will not be used at all
++            // So, just copy instructions to properties
++            final Properties properties = new Properties();
++            properties.putAll( instructions );
++
++            properties.put( "Generated-By-Ops4j-Pax-From", jarInfo );
++
++            final Analyzer analyzer = new Analyzer();
++            analyzer.setJar( jar );
++            analyzer.setProperties( properties );
++            if( manifest != null && OverwriteMode.MERGE == overwriteMode )
++            {
++                analyzer.mergeManifest( manifest );
++            }
++            checkMandatoryProperties( analyzer, jar, jarInfo );
++            try
++            {
 +                analyzer.calcManifest();
-+	    } catch(Exception e) {}
-         }
- 
-         return createInputStream( jar );
-@@ -164,12 +169,12 @@
-             {
-                 try
-                 {
--                    jar.write( pout );
-+                        jar.write( pout );
-                 }
-                 catch( IOException e )
-                 {
-                     LOG.warn( "Bundle cannot be generated" );
--                }
-+	        } catch(Exception e) {}
-                 finally
-                 {
-                     try
++            }
++            catch ( Exception e )
++            {
++                throw new Ops4jException( e );
++            }
++        }
++
++        return createInputStream( jar );
++    }
++
++    /**
++     * Creates an piped input stream for the wrapped jar.
++     * This is done in a thread so we can return quickly.
++     *
++     * @param jar the wrapped jar
++     *
++     * @return an input stream for the wrapped jar
++     *
++     * @throws java.io.IOException re-thrown
++     */
++    private static PipedInputStream createInputStream( final Jar jar )
++        throws IOException
++    {
++        final PipedInputStream pin = new PipedInputStream();
++        final PipedOutputStream pout = new PipedOutputStream( pin );
++
++        new Thread()
++        {
++            public void run()
++            {
++                try
++                {
++                    jar.write( pout );
++                }
++                catch( Exception e )
++                {
++                    LOG.warn( "Bundle cannot be generated" );
++                }
++                finally
++                {
++                    try
++                    {
++                        jar.close();
++                        pout.close();
++                    }
++                    catch( IOException ignore )
++                    {
++                        // if we get here something is very wrong
++                        LOG.error( "Bundle cannot be generated", ignore );
++                    }
++                }
++            }
++        }.start();
++
++        return pin;
++    }
++
++    /**
++     * Check if manadatory properties are present, otherwise generate default.
++     *
++     * @param analyzer     bnd analyzer
++     * @param jar          bnd jar
++     * @param symbolicName bundle symbolic name
++     */
++    private static void checkMandatoryProperties( final Analyzer analyzer,
++                                                  final Jar jar,
++                                                  final String symbolicName )
++    {
++        final String importPackage = analyzer.getProperty( Analyzer.IMPORT_PACKAGE );
++        if( importPackage == null || importPackage.trim().length() == 0 )
++        {
++            analyzer.setProperty( Analyzer.IMPORT_PACKAGE, "*;resolution:=optional" );
++        }
++        final String exportPackage = analyzer.getProperty( Analyzer.EXPORT_PACKAGE );
++        if( exportPackage == null || exportPackage.trim().length() == 0 )
++        {
++            analyzer.setProperty( Analyzer.EXPORT_PACKAGE, analyzer.calculateExportsFromContents( jar ) );
++        }
++        final String localSymbolicName = analyzer.getProperty( Analyzer.BUNDLE_SYMBOLICNAME, symbolicName );
++        analyzer.setProperty( Analyzer.BUNDLE_SYMBOLICNAME, generateSymbolicName( localSymbolicName ) );
++    }
++
++    /**
++     * Processes symbolic name and replaces osgi spec invalid characters with "_".
++     *
++     * @param symbolicName bundle symbolic name
++     *
++     * @return a valid symbolic name
++     */
++    private static String generateSymbolicName( final String symbolicName )
++    {
++        return symbolicName.replaceAll( "[^a-zA-Z_0-9.-]", "_" );
++    }
++
++    /**
++     * Parses bnd instructions out of an url query string.
++     *
++     * @param query query part of an url.
++     *
++     * @return parsed instructions as properties
++     *
++     * @throws java.net.MalformedURLException if provided path does not comply to syntax.
++     */
++    public static Properties parseInstructions( final String query )
++        throws MalformedURLException
++    {
++        final Properties instructions = new Properties();
++        if( query != null )
++        {
++            try
++            {
++                // just ignore for the moment and try out if we have valid properties separated by "&"
++                final String segments[] = query.split( "&" );
++                for( String segment : segments )
++                {
++                    // do not parse empty strings
++                    if( segment.trim().length() > 0 )
++                    {
++                        final Matcher matcher = INSTRUCTIONS_PATTERN.matcher( segment );
++                        if( matcher.matches() )
++                        {
++                            instructions.setProperty(
++                                verifyKey(matcher.group( 1 )),
++                                URLDecoder.decode( matcher.group( 2 ), "UTF-8" )
++                            );
++                        }
++                        else
++                        {
++                            throw new MalformedURLException( "Invalid syntax for instruction [" + segment
++                                                             + "]. Take a look at http://www.aqute.biz/Code/Bnd."
++                            );
++                        }
++                    }
++                }
++            }
++            catch( UnsupportedEncodingException e )
++            {
++                // thrown by URLDecoder but it should never happen
++                throwAsMalformedURLException( "Could not retrieve the instructions from [" + query + "]", e );
++            }
++        }
++        return instructions;
++    }
++
++    private static String verifyKey(String key) {
++		List<String> list = new ArrayList<String>(Arrays.asList(Constants.headers));
++		//patch the header list for an additional Web-ContextPath
++		list.add("Web-ContextPath");
++		if (list.contains(key)) {
++			return key;
++    	} else {
++			//this is not a key contained in the headers list
++			//either a specialized Camel-Case
++			//which is forwarded
++			if (CAMELCASE_PATTERN.matcher(key).matches()) { 
++				return key;
++    		} else {
++				//no Camel Case check if it exists in list 
++    			for (String header : list) {
++					if (header.equalsIgnoreCase(key)) {
++						return header;
++					}
++				}
++    			return key;
++			}
++		}
++	}
++
++	/**
++     * Creates an MalformedURLException with a message and a cause.
++     *
++     * @param message exception message
++     * @param cause   exception cause
++     *
++     * @throws MalformedURLException the created MalformedURLException
++     */
++    private static void throwAsMalformedURLException( final String message, final Exception cause )
++        throws MalformedURLException
++    {
++        final MalformedURLException exception = new MalformedURLException( message );
++        exception.initCause( cause );
++        throw exception;
++    }
++
++}
Index: ops4j-pax-swissbox-jpp-depmap.xml
===================================================================
RCS file: /home/projects/jpackage/cvs/rpms/free/ops4j-pax-swissbox/ops4j-pax-swissbox-jpp-depmap.xml,v
retrieving revision 1.1
diff -u -r1.1 ops4j-pax-swissbox-jpp-depmap.xml
--- ops4j-pax-swissbox-jpp-depmap.xml	6 Feb 2012 08:23:54 -0000	1.1
+++ ops4j-pax-swissbox-jpp-depmap.xml	20 Sep 2012 21:02:47 -0000
@@ -1,5 +1,18 @@
 <dependencies>
 
+ <dependency>
+   <maven>
+     <groupId>org.apache.felix</groupId>
+     <artifactId>org.apache.felix.bundlerepository</artifactId>
+     <version>1.6.4</version>
+   </maven>
+   <jpp>
+     <groupId>JPP/apache-felix</groupId>
+     <artifactId>org.apache.felix.bundlerepository</artifactId>
+     <version>1.6.4</version>
+   </jpp>
+ </dependency>
+
 <!--
  <dependency>
    <maven>
@@ -42,19 +55,6 @@
 
  <dependency>
    <maven>
-     <groupId>org.apache.felix</groupId>
-     <artifactId>org.apache.felix.bundlerepository</artifactId>
-     <version>1.6.4</version>
-   </maven>
-   <jpp>
-     <groupId>JPP/apache-felix</groupId>
-     <artifactId>org.apache.felix.bundlerepository</artifactId>
-     <version>1.6.4</version>
-   </jpp>
- </dependency>
-
- <dependency>
-   <maven>
      <groupId>org.apache.maven.shared</groupId>
      <artifactId>maven-common-artifact-filters</artifactId>
      <version>1.3</version>
Index: ops4j-pax-swissbox-pom.patch
===================================================================
RCS file: /home/projects/jpackage/cvs/rpms/free/ops4j-pax-swissbox/ops4j-pax-swissbox-pom.patch,v
retrieving revision 1.1
diff -u -r1.1 ops4j-pax-swissbox-pom.patch
--- ops4j-pax-swissbox-pom.patch	6 Feb 2012 08:23:54 -0000	1.1
+++ ops4j-pax-swissbox-pom.patch	20 Sep 2012 21:02:47 -0000
@@ -1,25 +1,18 @@
---- pom.xml.sav	2011-02-22 09:00:03.000000000 +0100
-+++ pom.xml	2011-02-22 09:00:23.000000000 +0100
-@@ -38,6 +38,7 @@
+--- pom.xml.sav	2012-09-19 15:39:39.785234069 +0200
++++ pom.xml	2012-09-19 15:40:00.059241279 +0200
+@@ -41,6 +41,7 @@
  
    <build>
      <plugins>
-+<!--
++      <!--
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>retrotranslator-maven-plugin</artifactId>
-@@ -54,6 +55,7 @@
+@@ -57,6 +58,7 @@
            </execution>
          </executions>
        </plugin>
-+-->
++      -->
      </plugins>
      <pluginManagement>
        <plugins>
-@@ -203,4 +205,4 @@
- 
-   </profiles>
- 
--</project>
-\ No newline at end of file
-+</project>
Index: ops4j-pax-swissbox.spec
===================================================================
RCS file: /home/projects/jpackage/cvs/rpms/free/ops4j-pax-swissbox/ops4j-pax-swissbox.spec,v
retrieving revision 1.1
diff -u -r1.1 ops4j-pax-swissbox.spec
--- ops4j-pax-swissbox.spec	6 Feb 2012 08:23:54 -0000	1.1
+++ ops4j-pax-swissbox.spec	20 Sep 2012 21:02:47 -0000
@@ -29,32 +29,36 @@
 #
 
 %define section         free
+%define _binary_payload w9.gzdio
+%define _source_payload w9.gzdio
+%define _binary_filedigest_algorithm 1
+%define _source_filedigest_algorithm 1
 
 Name:           ops4j-pax-swissbox
 Summary:        Pax OSGi swissbox
 Url:            http://wiki.ops4j.org/display/PAXSB/Pax+Swissbox
-Version:        1.3.0
-Release:        2%{?dist}
+Version:        1.5.1
+Release:        1%{?dist}
 Epoch:          0
 License:        Apache 2.0 License
 Group:          Development/Libraries
-Source0:        ops4j-pax-swissbox-1.3.0.tgz
-# svn export http://scm.ops4j.org/repos/ops4j/qa/pax/swissbox-1.3.0/ ops4j-pax-swissbox-1.3.0
-# tar czf ops4j-pax-swissbox-1.3.0.tgz ops4j-pax-swissbox-1.3.0/
+Source0:        ops4j-pax-swissbox-1.5.1.tgz
+# git clone https://github.com/ops4j/org.ops4j.pax.swissbox.git
+# cd org.ops4j.pax.swissbox/
+# git tag -l
+# git archive --prefix="ops4j-pax-swissbox-1.5.1/" --format=tar swissbox-1.5.1 | gzip > ../../SOURCES/ops4j-pax-swissbox-1.5.1.tgz
 
 Source1:        %{name}-settings.xml
 Source2:        %{name}-jpp-depmap.xml
 Patch0:         ops4j-pax-swissbox-pom.patch
-Patch1:         ops4j-pax-swissbox-converter-osgi-bnd.patch
-Patch2:         ops4j-pax-swissbox-samples-tinybundles-pom.patch
-Patch3:         ops4j-pax-swissbox-BndUtils.patch
+Patch1:         ops4j-pax-swissbox-BndUtils.patch
 
 BuildRequires:  jpackage-utils >= 0:1.7.5
 BuildRequires:  java-devel >= 0:1.6.0
 BuildRequires:  ant >= 0:1.7.1
 BuildRequires:  maven2 >= 0:2.0.8
 BuildRequires:  maven2-plugin-compiler
-BuildRequires:  maven2-plugin-idea
+BuildRequires:  maven2-plugin-dependency
 BuildRequires:  maven2-plugin-install
 BuildRequires:  maven2-plugin-jar
 BuildRequires:  maven2-plugin-javadoc
@@ -65,6 +69,7 @@
 BuildRequires:  maven-surefire-maven-plugin
 BuildRequires:  maven-surefire-provider-junit4
 BuildRequires:  maven-bundle-plugin
+BuildRequires:  eclipse-rcp
 
 BuildRequires:  ops4j-pax-master
 BuildRequires:  ops4j-base
@@ -106,8 +111,6 @@
 cp %{SOURCE1} settings.xml
 %patch0 -b .sav0
 %patch1 -b .sav1
-%patch2 -b .sav2
-%patch3 -b .sav3
 
 %build
 sed -i -e "s|<url>__JPP_URL_PLACEHOLDER__</url>|<url>file://`pwd`/.m2/repository</url>|g" settings.xml
@@ -115,6 +118,9 @@
 sed -i -e "s|<url>__MAVENREPO_DIR_PLACEHOLDER__</url>|<url>file://`pwd`/.m2/repository</url>|g" settings.xml
 
 export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
+mkdir -p ${MAVEN_REPO_LOCAL}/org/eclipse/tycho/org.eclipse.osgi/3.6.2.R36x_v20110210/
+ln -s /usr/lib*/eclipse/plugins/org.eclipse.osgi_3.6*.jar \
+      ${MAVEN_REPO_LOCAL}/org/eclipse/tycho/org.eclipse.osgi/3.6.2.R36x_v20110210/org.eclipse.osgi-3.6.2.R36x_v20110210.jar
 
 mkdir external_repo
 ln -s %{_javadir} external_repo/JPP
@@ -127,7 +133,7 @@
         -P release \
         -Dmaven2.jpp.depmap.file=%{SOURCE2} \
         -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
-        -Dmaven.test.failure.ignore=true \
+        -Dgpg.skip=true \
         install 
 mvn-jpp \
         -e \
@@ -163,6 +169,10 @@
 install -m 644 pax-swissbox-extender/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-swissbox-extender.pom
 install -m 644 pax-swissbox-extender/target/pax-swissbox-extender-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/swissbox-extender-%{version}.jar
 
+%add_to_maven_depmap org.ops4j.pax.swissbox pax-swissbox-framework %{version} JPP/%{name} swissbox-framework
+install -m 644 pax-swissbox-framework/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-swissbox-framework.pom
+install -m 644 pax-swissbox-framework/target/pax-swissbox-framework-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/swissbox-framework-%{version}.jar
+
 %add_to_maven_depmap org.ops4j.pax.swissbox pax-swissbox-lifecycle %{version} JPP/%{name} swissbox-lifecycle
 install -m 644 pax-swissbox-lifecycle/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-swissbox-lifecycle.pom
 install -m 644 pax-swissbox-lifecycle/target/pax-swissbox-lifecycle-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/swissbox-lifecycle-%{version}.jar
@@ -175,10 +185,6 @@
 install -m 644 pax-swissbox-property/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-swissbox-property.pom
 install -m 644 pax-swissbox-property/target/pax-swissbox-property-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/swissbox-property-%{version}.jar
 
-%add_to_maven_depmap org.ops4j.pax.swissbox pax-swissbox-tinybundles %{version} JPP/%{name} swissbox-tinybundles
-install -m 644 pax-swissbox-tinybundles/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-swissbox-tinybundles.pom
-install -m 644 pax-swissbox-tinybundles/target/pax-swissbox-tinybundles-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/swissbox-tinybundles-%{version}.jar
-
 %add_to_maven_depmap org.ops4j.pax.swissbox pax-swissbox-tracker %{version} JPP/%{name} swissbox-tracker
 install -m 644 pax-swissbox-tracker/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-swissbox-tracker.pom
 install -m 644 pax-swissbox-tracker/target/pax-swissbox-tracker-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/swissbox-tracker-%{version}.jar
@@ -211,6 +217,9 @@
 %doc %{_javadocdir}/*
 
 %changelog
+* Thu Sep 20 2012 Ralph Apel <r.apel at r-apel.de> 0:1.5.1-1
+- 1.5.1
+
 * Sun Feb 05 2012 Ralph Apel <r.apel at r-apel.de> 0:1.3.0-2
 - Promote to free