karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré ...@nanthrax.net>
Subject Re: Problem in the matching of jars to be wrapped (was Re: svn commit: r1059934 - in /karaf/trunk: ./ assembly/ assembly/src/main/descriptors/ assembly/src/main/filtered-resources/etc/ deployer/ deployer/wrap/ deployer/wrap/src/ deployer/wrap/src/main/ d
Date Fri, 21 Jan 2011 05:42:45 GMT
Hi Guillaume,

thanks for the warn, I'm gonna reopen the JIRA and update the wrap 
deployer in that way :)
Sorry for this mistake.

Regards
JB

On 01/21/2011 12:22 AM, Guillaume Nodet wrote:
> Would you please consider fixing the code according to what we
> discussed on the dev list or JIRA ?
> I think we agreed that we should only check for files ending with
> ".jar" so as to not intercept all zip that aren't bundles (that
> includes wars, kars, jbi, etc...).
>
> On Mon, Jan 17, 2011 at 15:36,<jbonofre@apache.org>  wrote:
>> Author: jbonofre
>> Date: Mon Jan 17 14:36:04 2011
>> New Revision: 1059934
>>
>> URL: http://svn.apache.org/viewvc?rev=1059934&view=rev
>> Log:
>> [KARAF-380] Add a very simple wrap deployer for non OSGi jar files.
>>
>> Added:
>>     karaf/trunk/deployer/wrap/
>>     karaf/trunk/deployer/wrap/pom.xml
>>     karaf/trunk/deployer/wrap/src/
>>     karaf/trunk/deployer/wrap/src/main/
>>     karaf/trunk/deployer/wrap/src/main/java/
>>     karaf/trunk/deployer/wrap/src/main/java/org/
>>     karaf/trunk/deployer/wrap/src/main/java/org/apache/
>>     karaf/trunk/deployer/wrap/src/main/java/org/apache/karaf/
>>     karaf/trunk/deployer/wrap/src/main/java/org/apache/karaf/deployer/
>>     karaf/trunk/deployer/wrap/src/main/java/org/apache/karaf/deployer/wrap/
>>     karaf/trunk/deployer/wrap/src/main/java/org/apache/karaf/deployer/wrap/WrapDeploymentListener.java
>>     karaf/trunk/deployer/wrap/src/main/resources/
>>     karaf/trunk/deployer/wrap/src/main/resources/OSGI-INF/
>>     karaf/trunk/deployer/wrap/src/main/resources/OSGI-INF/blueprint/
>>     karaf/trunk/deployer/wrap/src/main/resources/OSGI-INF/blueprint/wrap-deployer.xml
>> Modified:
>>     karaf/trunk/assembly/pom.xml
>>     karaf/trunk/assembly/src/main/descriptors/unix-bin.xml
>>     karaf/trunk/assembly/src/main/descriptors/windows-bin.xml
>>     karaf/trunk/assembly/src/main/filtered-resources/etc/startup.properties
>>     karaf/trunk/deployer/pom.xml
>>     karaf/trunk/pom.xml
>>
>> Modified: karaf/trunk/assembly/pom.xml
>> URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/pom.xml?rev=1059934&r1=1059933&r2=1059934&view=diff
>> ==============================================================================
>> --- karaf/trunk/assembly/pom.xml (original)
>> +++ karaf/trunk/assembly/pom.xml Mon Jan 17 14:36:04 2011
>> @@ -80,6 +80,10 @@
>>              <artifactId>org.apache.karaf.deployer.war</artifactId>
>>          </dependency>
>>          <dependency>
>> +<groupId>org.apache.karaf.deployer</groupId>
>> +<artifactId>org.apache.karaf.deployer.wrap</artifactId>
>> +</dependency>
>> +<dependency>
>>              <groupId>org.apache.karaf.features</groupId>
>>              <artifactId>org.apache.karaf.features.core</artifactId>
>>          </dependency>
>>
>> Modified: karaf/trunk/assembly/src/main/descriptors/unix-bin.xml
>> URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/src/main/descriptors/unix-bin.xml?rev=1059934&r1=1059933&r2=1059934&view=diff
>> ==============================================================================
>> --- karaf/trunk/assembly/src/main/descriptors/unix-bin.xml (original)
>> +++ karaf/trunk/assembly/src/main/descriptors/unix-bin.xml Mon Jan 17 14:36:04 2011
>> @@ -235,6 +235,7 @@
>>                  <include>org.apache.karaf.deployer:org.apache.karaf.deployer.blueprint</include>
>>                  <include>org.apache.karaf.deployer:org.apache.karaf.deployer.features</include>
>>                  <include>org.apache.karaf.deployer:org.apache.karaf.deployer.kar</include>
>> +<include>org.apache.karaf.deployer:org.apache.karaf.deployer.wrap</include>
>>              </includes>
>>          </dependencySet>
>>          <dependencySet>
>>
>> Modified: karaf/trunk/assembly/src/main/descriptors/windows-bin.xml
>> URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/src/main/descriptors/windows-bin.xml?rev=1059934&r1=1059933&r2=1059934&view=diff
>> ==============================================================================
>> --- karaf/trunk/assembly/src/main/descriptors/windows-bin.xml (original)
>> +++ karaf/trunk/assembly/src/main/descriptors/windows-bin.xml Mon Jan 17 14:36:04
2011
>> @@ -222,6 +222,7 @@
>>                  <include>org.apache.karaf.deployer:org.apache.karaf.deployer.blueprint</include>
>>                  <include>org.apache.karaf.deployer:org.apache.karaf.deployer.features</include>
>>                  <include>org.apache.karaf.deployer:org.apache.karaf.deployer.kar</include>
>> +<include>org.apache.karaf.deployer:org.apache.karaf.deployer.wrap</include>
>>              </includes>
>>          </dependencySet>
>>          <dependencySet>
>>
>> Modified: karaf/trunk/assembly/src/main/filtered-resources/etc/startup.properties
>> URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/src/main/filtered-resources/etc/startup.properties?rev=1059934&r1=1059933&r2=1059934&view=diff
>> ==============================================================================
>> --- karaf/trunk/assembly/src/main/filtered-resources/etc/startup.properties (original)
>> +++ karaf/trunk/assembly/src/main/filtered-resources/etc/startup.properties Mon Jan
17 14:36:04 2011
>> @@ -72,3 +72,4 @@ org/apache/karaf/deployer/org.apache.kar
>>   org/apache/karaf/deployer/org.apache.karaf.deployer.blueprint/${project.version}/org.apache.karaf.deployer.blueprint-${project.version}.jar=30
>>   org/apache/karaf/deployer/org.apache.karaf.deployer.features/${project.version}/org.apache.karaf.deployer.features-${project.version}.jar=30
>>   org/apache/karaf/deployer/org.apache.karaf.deployer.kar/${project.version}/org.apache.karaf.deployer.kar-${project.version}.jar=30
>> +org/apache/karaf/deployer/org.apache.karaf.deployer.wrap/${project.version}/org.apache.karaf.deployer.wrap-${project.version}.jar=30
>>
>> Modified: karaf/trunk/deployer/pom.xml
>> URL: http://svn.apache.org/viewvc/karaf/trunk/deployer/pom.xml?rev=1059934&r1=1059933&r2=1059934&view=diff
>> ==============================================================================
>> --- karaf/trunk/deployer/pom.xml (original)
>> +++ karaf/trunk/deployer/pom.xml Mon Jan 17 14:36:04 2011
>> @@ -38,6 +38,7 @@
>>          <module>features</module>
>>          <module>war</module>
>>          <module>kar</module>
>> +<module>wrap</module>
>>      </modules>
>>
>>   </project>
>>
>> Added: karaf/trunk/deployer/wrap/pom.xml
>> URL: http://svn.apache.org/viewvc/karaf/trunk/deployer/wrap/pom.xml?rev=1059934&view=auto
>> ==============================================================================
>> --- karaf/trunk/deployer/wrap/pom.xml (added)
>> +++ karaf/trunk/deployer/wrap/pom.xml Mon Jan 17 14:36:04 2011
>> @@ -0,0 +1,78 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<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">
>> +
>> +<!--
>> +
>> +        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.
>> +    -->
>> +
>> +<modelVersion>4.0.0</modelVersion>
>> +
>> +<parent>
>> +<groupId>org.apache.karaf.deployer</groupId>
>> +<artifactId>deployer</artifactId>
>> +<version>2.1.99-SNAPSHOT</version>
>> +</parent>
>> +
>> +<artifactId>org.apache.karaf.deployer.wrap</artifactId>
>> +<packaging>bundle</packaging>
>> +<name>Apache Karaf :: Deployer :: Wrap Non OSGi Jar</name>
>> +
>> +<description>This deployer transforms non OSGi jar files to a deployable bundle</description>
>> +
>> +<properties>
>> +<appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
>> +</properties>
>> +
>> +<dependencies>
>> +<dependency>
>> +<groupId>org.osgi</groupId>
>> +<artifactId>org.osgi.core</artifactId>
>> +<scope>provided</scope>
>> +</dependency>
>> +<dependency>
>> +<groupId>commons-logging</groupId>
>> +<artifactId>commons-logging</artifactId>
>> +</dependency>
>> +<dependency>
>> +<groupId>org.apache.felix</groupId>
>> +<artifactId>org.apache.felix.fileinstall</artifactId>
>> +</dependency>
>> +<dependency>
>> +<groupId>org.apache.servicemix.bundles</groupId>
>> +<artifactId>org.apache.servicemix.bundles.junit</artifactId>
>> +</dependency>
>> +</dependencies>
>> +
>> +<build>
>> +<plugins>
>> +<plugin>
>> +<groupId>org.apache.felix</groupId>
>> +<artifactId>maven-bundle-plugin</artifactId>
>> +<configuration>
>> +<instructions>
>> +<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
>> +<Export-Package>${project.artifactId}*;version=${project.version}</Export-Package>
>> +<Import-Package>!${project.artifactId}*,*</Import-Package>
>> +<Private-Package>org.apache.karaf.deployer.wrap</Private-Package>
>> +<_versionpolicy>${bnd.version.policy}</_versionpolicy>
>> +</instructions>
>> +</configuration>
>> +</plugin>
>> +</plugins>
>> +</build>
>> +
>> +</project>
>> \ No newline at end of file
>>
>> Added: karaf/trunk/deployer/wrap/src/main/java/org/apache/karaf/deployer/wrap/WrapDeploymentListener.java
>> URL: http://svn.apache.org/viewvc/karaf/trunk/deployer/wrap/src/main/java/org/apache/karaf/deployer/wrap/WrapDeploymentListener.java?rev=1059934&view=auto
>> ==============================================================================
>> --- karaf/trunk/deployer/wrap/src/main/java/org/apache/karaf/deployer/wrap/WrapDeploymentListener.java
(added)
>> +++ karaf/trunk/deployer/wrap/src/main/java/org/apache/karaf/deployer/wrap/WrapDeploymentListener.java
Mon Jan 17 14:36:04 2011
>> @@ -0,0 +1,61 @@
>> +/**
>> + *
>> + * 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.karaf.deployer.wrap;
>> +
>> +import org.apache.felix.fileinstall.ArtifactUrlTransformer;
>> +
>> +import java.io.File;
>> +import java.net.URL;
>> +import java.util.jar.Attributes;
>> +import java.util.jar.JarFile;
>> +import java.util.jar.Manifest;
>> +
>> +/**
>> + *<p>
>> + * A deployment listener that listens for non OSGi jar deployements.
>> + *</p>
>> + *
>> + * @author jbonofre
>> + */
>> +public class WrapDeploymentListener implements ArtifactUrlTransformer {
>> +
>> +    public boolean canHandle(File artifact) {
>> +        try {
>> +            JarFile jar = new JarFile(artifact);
>> +            // only handle non OSGi jar
>> +            Manifest manifest = jar.getManifest();
>> +            if (manifest != null&&
>> +                manifest.getMainAttributes().getValue(new Attributes.Name("Bundle-SymbolicName"))
!= null&&
>> +                manifest.getMainAttributes().getValue(new Attributes.Name("Bundle-Version"))
!= null) {
>> +                return false;
>> +            }
>> +            return true;
>> +        } catch (Exception e) {
>> +            return false;
>> +        }
>> +    }
>> +
>> +    public URL transform(URL artifact) throws Exception {
>> +        String path = artifact.getPath();
>> +        String protocol = artifact.getProtocol();
>> +
>> +        // TODO add Bundle-SymbolicName and Bundle-Version to the wrap URL
>> +        return new URL("wrap", null, protocol + ":" + path);
>> +    }
>> +
>> +}
>>
>> Added: karaf/trunk/deployer/wrap/src/main/resources/OSGI-INF/blueprint/wrap-deployer.xml
>> URL: http://svn.apache.org/viewvc/karaf/trunk/deployer/wrap/src/main/resources/OSGI-INF/blueprint/wrap-deployer.xml?rev=1059934&view=auto
>> ==============================================================================
>> --- karaf/trunk/deployer/wrap/src/main/resources/OSGI-INF/blueprint/wrap-deployer.xml
(added)
>> +++ karaf/trunk/deployer/wrap/src/main/resources/OSGI-INF/blueprint/wrap-deployer.xml
Mon Jan 17 14:36:04 2011
>> @@ -0,0 +1,29 @@
>> +<?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.
>> +
>> +-->
>> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>> +           default-activation="lazy">
>> +
>> +<bean id="wrapDeploymentListener" class="org.apache.karaf.deployer.wrap.WrapDeploymentListener"/>
>> +
>> +<reference id="wrapUrlHandlerRef" interface="org.osgi.service.url.URLStreamHandlerService"
filter="url.handler.protocol=wrap"/>
>> +
>> +<service ref="wrapDeploymentListener" auto-export="interfaces" depends-on="wrapDeploymentListener"/>
>> +
>> +</blueprint>
>> \ No newline at end of file
>>
>> Modified: karaf/trunk/pom.xml
>> URL: http://svn.apache.org/viewvc/karaf/trunk/pom.xml?rev=1059934&r1=1059933&r2=1059934&view=diff
>> ==============================================================================
>> --- karaf/trunk/pom.xml (original)
>> +++ karaf/trunk/pom.xml Mon Jan 17 14:36:04 2011
>> @@ -286,6 +286,11 @@
>>                  <version>${project.version}</version>
>>              </dependency>
>>              <dependency>
>> +<groupId>org.apache.karaf.deployer</groupId>
>> +<artifactId>org.apache.karaf.deployer.wrap</artifactId>
>> +<version>${project.version}</version>
>> +</dependency>
>> +<dependency>
>>                  <groupId>org.apache.karaf</groupId>
>>                  <artifactId>org.apache.karaf.management</artifactId>
>>                  <version>${project.version}</version>
>>
>>
>>
>
>
>

Mime
View raw message