[jboss-dev] jboss-cvs-commits Digest, Vol 43, Issue 300

Ales Justin ales.justin at gmail.com
Tue Jan 26 06:30:41 EST 2010


Did we agree on fragments?

You also shouldn't update pom info to MC kernel,
as this is meant for 2.2.x versions -- whereas this is 2.0.x branch.

And what's with the CLMD serialVersionUID change?

-Ales

> ------------------------------
> 
> Message: 7
> Date: Tue, 26 Jan 2010 06:22:59 -0500
> From: jboss-cvs-commits at lists.jboss.org
> Subject: [jboss-cvs] JBossAS SVN: r99932 - in
> 	projects/jboss-cl/branches/Branch_2_0:
> 	classloader/src/main/java/org/jboss/classloader/spi and 5	other
> 	directories.
> To: jboss-cvs-commits at lists.jboss.org
> Message-ID:
> 	<201001261122.o0QBMxWg030714 at svn01.web.mwc.hst.phx2.redhat.com>
> Content-Type: text/plain; charset=UTF-8
> 
> Author: thomas.diesler at jboss.com
> Date: 2010-01-26 06:22:59 -0500 (Tue, 26 Jan 2010)
> New Revision: 99932
> 
> Added:
>    projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java
> Modified:
>    projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java
>    projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java
>    projects/jboss-cl/branches/Branch_2_0/classloading-vfs/pom.xml
>    projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
>    projects/jboss-cl/branches/Branch_2_0/classloading/pom.xml
>    projects/jboss-cl/branches/Branch_2_0/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java
>    projects/jboss-cl/branches/Branch_2_0/pom.xml
> Log:
> [JBCL-136] Add a notion of native library mapping
> [JBCL-137] Add support for OSGi fragments
> 
> 
> 
> Modified: projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java
> ===================================================================
> --- projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java	2010-01-26 10:48:51 UTC (rev 99931)
> +++ projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java	2010-01-26 11:22:59 UTC (rev 99932)
> @@ -21,6 +21,7 @@
>   */
>  package org.jboss.classloader.spi;
>  
> +import java.io.File;
>  import java.io.IOException;
>  import java.io.InputStream;
>  import java.net.URL;
> @@ -47,6 +48,7 @@
>   * ClassLoader policy.
>   * 
>   * @author <a href="adrian at jboss.com">Adrian Brock</a>
> + * @author thomas.diesler at jboss.com
>   * @version $Revision: 1.1 $
>   */
>  public abstract class ClassLoaderPolicy extends BaseClassLoaderPolicy implements ClassNotFoundHandler, ClassFoundHandler
> @@ -59,8 +61,62 @@
>  
>     /** The class found handlers */
>     private List<ClassFoundHandler> classFoundHandlers;
> +
> +   /** Maps native library to its provider */
> +   private volatile List<NativeLibraryProvider> nativeLibraries;
>     
>     /**
> +    * Add a native library provider.
> +    * @param provider The library file provider
> +    */
> +   public void addNativeLibrary(NativeLibraryProvider provider)
> +   {
> +      if (nativeLibraries == null)
> +         nativeLibraries = new CopyOnWriteArrayList<NativeLibraryProvider>();
> +      
> +      nativeLibraries.add(provider);
> +   }
> +   
> +   /**
> +    * Returns the absolute path name of a native library.
> +    * 
> +    * @param libname The library name 
> +    * @return The absolute path of the native library, or null
> +    */
> +   public String findLibrary(String libname)
> +   {
> +      List<NativeLibraryProvider> list = nativeLibraries;
> +      if (list == null)
> +         return null;
> +      
> +      NativeLibraryProvider libProvider = null;
> +      for (NativeLibraryProvider aux : list)
> +      {
> +         if (libname.equals(aux.getLibraryName()))
> +         {
> +            libProvider = aux;
> +            break;
> +         }
> +      }
> +      
> +      if (libProvider == null)
> +         return null;
> +      
> +      File libfile;
> +      try
> +      {
> +         libfile = libProvider.getLibraryLocation();
> +      }
> +      catch (IOException ex)
> +      {
> +         log.error("Cannot privide native library location for: " + libname, ex);
> +         return null;
> +      }
> +      
> +      return libfile.getAbsolutePath();
> +   }
> +   
> +   /**
>      * Get the delegate loader for exported stuff<p>
>      *
>      * By default this uses {@link #getPackageNames()} to create a {@link FilteredDelegateLoader}
> 
> Copied: projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java (from rev 99803, projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java)
> ===================================================================
> --- projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java	                        (rev 0)
> +++ projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java	2010-01-26 11:22:59 UTC (rev 99932)
> @@ -0,0 +1,63 @@
> +/*
> +* JBoss, Home of Professional Open Source
> +* Copyright 2010, JBoss Inc., and individual contributors as indicated
> +* by the @authors tag. See the copyright.txt in the distribution for a
> +* full listing of individual contributors.
> +*
> +* This is free software; you can redistribute it and/or modify it
> +* under the terms of the GNU Lesser General Public License as
> +* published by the Free Software Foundation; either version 2.1 of
> +* the License, or (at your option) any later version.
> +*
> +* This software is distributed in the hope that it will be useful,
> +* but WITHOUT ANY WARRANTY; without even the implied warranty of
> +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> +* Lesser General Public License for more details.
> +*
> +* You should have received a copy of the GNU Lesser General Public
> +* License along with this software; if not, write to the Free
> +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> +* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> +*/
> +package org.jboss.classloader.spi;
> +
> +import java.io.File;
> +import java.io.IOException;
> +
> +/**
> + * Provides the local file location for a native library.
> + * 
> + * @author thomas.diesler at jboss.com
> + * @author <a href="adrian at jboss.com">Adrian Brock</a>
> + * @version $Revision: 1.1 $
> + */
> +public interface NativeLibraryProvider
> +{
> +   /**
> +    * Get the library name.
> +    * 
> +    * As it is used in the call to {@link System#loadLibrary(String)} 
> +    * 
> +    * @return the library path
> +    */
> +   String getLibraryName();
> +   
> +   /**
> +    * Get the library path.
> +    * 
> +    * Relative to the deployment root.
> +    * 
> +    * @return the library path
> +    */
> +   String getLibraryPath();
> +   
> +   /**
> +    * Get the local library file location. 
> +    * 
> +    * This may be proved lazily.
> +    * 
> +    * @return The native library file
> +    * @throws IOException for any error
> +    */
> +   File getLibraryLocation() throws IOException;
> +}
> 
> Modified: projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java
> ===================================================================
> --- projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java	2010-01-26 10:48:51 UTC (rev 99931)
> +++ projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java	2010-01-26 11:22:59 UTC (rev 99932)
> @@ -59,6 +59,8 @@
>  
>  /**
>   * BaseClassLoader.
> + * 
> + * [TODO] Add meaningful javadoc
>   *
>   * @author <a href="adrian at jboss.com">Adrian Brock</a>
>   * @version $Revision: 1.1 $
> @@ -372,6 +374,20 @@
>        return domain.checkClassCacheAndBlackList(this, name, null, basePolicy.isImportAll(), false);
>     }
>  
> +   @Override
> +   protected String findLibrary(String libname)
> +   {
> +      String libraryPath = null;
> +
> +      if (policy != null)
> +         libraryPath = policy.findLibrary(libname);
> +
> +      if (libraryPath == null)
> +         libraryPath = super.findLibrary(libname);
> +
> +      return libraryPath;
> +   }
> +   
>     /**
>      * Find the classloader for a class but don't load the class
>      *
> 
> Modified: projects/jboss-cl/branches/Branch_2_0/classloading/pom.xml
> ===================================================================
> --- projects/jboss-cl/branches/Branch_2_0/classloading/pom.xml	2010-01-26 10:48:51 UTC (rev 99931)
> +++ projects/jboss-cl/branches/Branch_2_0/classloading/pom.xml	2010-01-26 11:22:59 UTC (rev 99932)
> @@ -31,42 +31,14 @@
>      </dependency>
>      
>      <dependency>
> -      <groupId>org.jboss.microcontainer</groupId>
> +      <groupId>org.jboss.kernel</groupId>
>        <artifactId>jboss-dependency</artifactId>
> -      <exclusions>
> -        <exclusion>
> -          <groupId>org.jboss</groupId>
> -          <artifactId>jboss-common-core</artifactId>
> -        </exclusion>
> -        <exclusion>
> -          <groupId>jboss</groupId>
> -          <artifactId>jboss-common-logging-spi</artifactId>
> -        </exclusion>
> -      </exclusions>
>      </dependency>
>      
>      <dependency>
> -      <groupId>org.jboss.microcontainer</groupId>
> +      <groupId>org.jboss.kernel</groupId>
>        <artifactId>jboss-kernel</artifactId>
>        <optional>true</optional>
> -      <exclusions>
> -        <exclusion>
> -          <groupId>org.jboss.microcontainer</groupId>
> -          <artifactId>jboss-dependency</artifactId>
> -        </exclusion>
> -        <exclusion>
> -          <groupId>org.jboss</groupId>
> -          <artifactId>jboss-common-core</artifactId>
> -        </exclusion>
> -        <exclusion>
> -          <groupId>jboss</groupId>
> -          <artifactId>jboss-common-logging-spi</artifactId>
> -        </exclusion>
> -        <exclusion>
> -          <groupId>org.jboss</groupId>
> -          <artifactId>jbossxb</artifactId>
> -        </exclusion>
> -      </exclusions>
>      </dependency>
>      
>      <dependency>
> 
> Modified: projects/jboss-cl/branches/Branch_2_0/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java
> ===================================================================
> --- projects/jboss-cl/branches/Branch_2_0/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java	2010-01-26 10:48:51 UTC (rev 99931)
> +++ projects/jboss-cl/branches/Branch_2_0/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java	2010-01-26 11:22:59 UTC (rev 99932)
> @@ -22,6 +22,7 @@
>  package org.jboss.classloading.spi.metadata;
>  
>  import java.util.List;
> +
>  import javax.xml.bind.annotation.XmlAttribute;
>  import javax.xml.bind.annotation.XmlTransient;
>  
> @@ -36,6 +37,8 @@
>  /**
>   * ClassLoadingMetaData.
>   * 
> + * [TODO] Add meaningful javadoc
> + * 
>   * @author <a href="adrian at jboss.org">Adrian Brock</a>
>   * @version $Revision: 1.1 $
>   */
> @@ -43,7 +46,7 @@
>  public class ClassLoadingMetaData extends NameAndVersionSupport
>  {
>     /** The serialVersionUID */
> -   private static final long serialVersionUID = -2782951093046585620L;
> +   private static final long serialVersionUID = 8574522599537469347L;
>     
>     /** The classloading domain */
>     private String domain;
> 
> Modified: projects/jboss-cl/branches/Branch_2_0/classloading-vfs/pom.xml
> ===================================================================
> --- projects/jboss-cl/branches/Branch_2_0/classloading-vfs/pom.xml	2010-01-26 10:48:51 UTC (rev 99931)
> +++ projects/jboss-cl/branches/Branch_2_0/classloading-vfs/pom.xml	2010-01-26 11:22:59 UTC (rev 99932)
> @@ -39,30 +39,12 @@
>            <groupId>org.jboss.cl</groupId>
>            <artifactId>jboss-classloader</artifactId>
>          </exclusion>
> -        <exclusion>
> -          <groupId>org.jboss.microcontainer</groupId>
> -          <artifactId>jboss-kernel</artifactId>
> -        </exclusion>
>        </exclusions>
>      </dependency>
>  
>      <dependency>
> -      <groupId>org.jboss.microcontainer</groupId>
> +      <groupId>org.jboss.kernel</groupId>
>        <artifactId>jboss-kernel</artifactId>
> -      <exclusions>
> -        <exclusion>
> -          <groupId>org.jboss</groupId>
> -          <artifactId>jboss-common-core</artifactId>
> -        </exclusion>
> -        <exclusion>
> -          <groupId>jboss</groupId>
> -          <artifactId>jboss-common-logging-spi</artifactId>
> -        </exclusion>
> -        <exclusion>
> -          <groupId>org.jboss</groupId>
> -          <artifactId>jbossxb</artifactId>
> -        </exclusion>
> -      </exclusions>
>      </dependency>
>      
>      <dependency>
> @@ -104,9 +86,13 @@
>          </exclusion>
>        </exclusions>
>      </dependency>
> -    
>      <dependency>
>        <groupId>org.jboss</groupId>
> +      <artifactId>jboss-mdr</artifactId>
> +      <scope>provided</scope>
> +    </dependency>
> +    <dependency>
> +      <groupId>org.jboss</groupId>
>        <artifactId>jboss-vfs</artifactId>
>        <exclusions>
>          <exclusion>
> 
> Modified: projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
> ===================================================================
> --- projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java	2010-01-26 10:48:51 UTC (rev 99931)
> +++ projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java	2010-01-26 11:22:59 UTC (rev 99932)
> @@ -35,6 +35,7 @@
>  import java.util.Map;
>  import java.util.Set;
>  import java.util.concurrent.ConcurrentHashMap;
> +import java.util.concurrent.CopyOnWriteArrayList;
>  import java.util.jar.Manifest;
>  
>  import org.jboss.classloader.plugins.ClassLoaderUtils;
> @@ -53,9 +54,12 @@
>  /**
>   * VFSClassLoaderPolicy.
>   * 
> + * [TODO] add meaningful javadoc
> + * 
>   * @author <a href="adrian at jboss.org">Adrian Brock</a> 
>   * @author <a href="ales.justin at jboss.org">Ales Justin</a>
>   * @author <a href="anil.saldhana at jboss.org">Anil Saldhana</a>
> + * @author Thomas.Diesler at jboss.com
>   * @version $Revision: 1.1 $
>   */
>  public class VFSClassLoaderPolicy extends ClassLoaderPolicy
> @@ -75,6 +79,9 @@
>     /** The roots */
>     private VirtualFile[] roots;
>     
> +   /** The fragment roots */
> +   private List<VirtualFile> fragments;
> +   
>     /** The excluded roots */
>     private VirtualFile[] excludedRoots;
>  
> @@ -261,6 +268,51 @@
>        return name;
>     }
>  
> +   /**
> +    * Attach a new fragment root to the policy.
> +    * @param fragRoot The fragment root file
> +    */
> +   public void attachFragment(VirtualFile fragRoot)
> +   {
> +      if (fragRoot == null)
> +         throw new IllegalArgumentException("Null fragment file");
> +      
> +      if (fragments == null)
> +         fragments = new CopyOnWriteArrayList<VirtualFile>();
> +      
> +      fragments.add(fragRoot);
> +   }
> +   
> +   /**
> +    * Detach a fragment root from the policy.
> +    * @param fragRoot The fragment root file
> +    * @return true if the fragment could be detached
> +    */
> +   public boolean detachFragment(VirtualFile fragRoot)
> +   {
> +      if (fragRoot == null)
> +         throw new IllegalArgumentException("Null fragment file");
> +      
> +      if (fragments == null)
> +         return false;
> +      
> +      return fragments.remove(fragRoot);
> +   }
> +   
> +   /**
> +    * Get the array of attached fragment root files.
> +    * @return The array of attached fragment root files or null.
> +    */
> +   public VirtualFile[] getFragmentRoots()
> +   {
> +      if (fragments == null)
> +         return null;
> +      
> +      VirtualFile[] retarr = new VirtualFile[fragments.size()];
> +      fragments.toArray(retarr);
> +      return retarr;
> +   }
> +
>     @Override
>     public List<? extends DelegateLoader> getDelegates()
>     {
> @@ -589,6 +641,27 @@
>           {
>           }
>        }
> +      
> +      if (fragments != null)
> +      {
> +         for (VirtualFile root : fragments)
> +         {
> +            try
> +            {
> +               VirtualFile file = root.getChild(path);
> +               if (file != null)
> +               {
> +                  result = new VirtualFileInfo(file, root);
> +                  vfsCache.put(path, result);
> +                  return result;
> +               }
> +            }
> +            catch (Exception ignored)
> +            {
> +            }
> +         }
> +      }
> +      
>        return null;
>     }
>     
> 
> Modified: projects/jboss-cl/branches/Branch_2_0/pom.xml
> ===================================================================
> --- projects/jboss-cl/branches/Branch_2_0/pom.xml	2010-01-26 10:48:51 UTC (rev 99931)
> +++ projects/jboss-cl/branches/Branch_2_0/pom.xml	2010-01-26 11:22:59 UTC (rev 99932)
> @@ -32,7 +32,8 @@
>    <properties>
>      <version.jboss.vfs>2.1.3.SP1</version.jboss.vfs>
>      <version.jboss.man>2.1.1.CR1</version.jboss.man>
> -    <version.jboss.microcontainer>2.0.9.GA</version.jboss.microcontainer>
> +    <version.jboss.mdr>2.2.0.Alpha1</version.jboss.mdr>
> +    <version.jboss.kernel>2.2.0.Alpha2</version.jboss.kernel>
>      <version.jboss.common.core>2.2.14.GA</version.jboss.common.core>
>      <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
>      <version.jboss.classloading.spi>5.1.0.SP1</version.jboss.classloading.spi>
> @@ -201,15 +202,21 @@
>        </dependency>
>        
>        <dependency>
> -        <groupId>org.jboss.microcontainer</groupId>
> +        <groupId>org.jboss</groupId>
> +        <artifactId>jboss-mdr</artifactId>
> +        <version>${version.jboss.mdr}</version>
> +      </dependency>
> +      
> +      <dependency>
> +        <groupId>org.jboss.kernel</groupId>
>          <artifactId>jboss-dependency</artifactId>
> -        <version>${version.jboss.microcontainer}</version>
> +        <version>${version.jboss.kernel}</version>
>        </dependency>
>        
>        <dependency>
> -        <groupId>org.jboss.microcontainer</groupId>
> +        <groupId>org.jboss.kernel</groupId>
>          <artifactId>jboss-kernel</artifactId>
> -        <version>${version.jboss.microcontainer}</version>
> +        <version>${version.jboss.kernel}</version>
>        </dependency>
>        
>        <dependency>
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> jboss-cvs-commits mailing list
> jboss-cvs-commits at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-cvs-commits
> 
> 
> End of jboss-cvs-commits Digest, Vol 43, Issue 300
> **************************************************
> 



More information about the jboss-development mailing list