[jboss-cvs] JBossAS SVN: r80482 - in projects/jboss-cl/tags: 2.0.0.CR5 and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 4 07:22:48 EST 2008
Author: alesj
Date: 2008-11-04 07:22:47 -0500 (Tue, 04 Nov 2008)
New Revision: 80482
Added:
projects/jboss-cl/tags/2.0.0.CR5/
projects/jboss-cl/tags/2.0.0.CR5/build/pom.xml
projects/jboss-cl/tags/2.0.0.CR5/classloader/pom.xml
projects/jboss-cl/tags/2.0.0.CR5/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java
projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/pom.xml
projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java
projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java
projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/metadata/VFSClassLoaderFactory.java
projects/jboss-cl/tags/2.0.0.CR5/classloading/pom.xml
projects/jboss-cl/tags/2.0.0.CR5/pom.xml
Removed:
projects/jboss-cl/tags/2.0.0.CR5/build/pom.xml
projects/jboss-cl/tags/2.0.0.CR5/classloader/pom.xml
projects/jboss-cl/tags/2.0.0.CR5/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java
projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/pom.xml
projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java
projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java
projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/metadata/VFSClassLoaderFactory.java
projects/jboss-cl/tags/2.0.0.CR5/classloading/pom.xml
projects/jboss-cl/tags/2.0.0.CR5/pom.xml
Log:
[maven-release-plugin] copy for tag 2.0.0.CR5
Copied: projects/jboss-cl/tags/2.0.0.CR5 (from rev 80027, projects/jboss-cl/branches/Branch_2_0)
Deleted: projects/jboss-cl/tags/2.0.0.CR5/build/pom.xml
===================================================================
--- projects/jboss-cl/branches/Branch_2_0/build/pom.xml 2008-10-24 08:59:07 UTC (rev 80027)
+++ projects/jboss-cl/tags/2.0.0.CR5/build/pom.xml 2008-11-04 12:22:47 UTC (rev 80482)
@@ -1,31 +0,0 @@
-<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/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-cl</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-cl-dist</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>JBoss ClassLoader Distribution Build</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss ClassLoader Distribution Build</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/dist.xml</descriptor>
- <descriptor>src/assembly/src.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
Copied: projects/jboss-cl/tags/2.0.0.CR5/build/pom.xml (from rev 80481, projects/jboss-cl/branches/Branch_2_0/build/pom.xml)
===================================================================
--- projects/jboss-cl/tags/2.0.0.CR5/build/pom.xml (rev 0)
+++ projects/jboss-cl/tags/2.0.0.CR5/build/pom.xml 2008-11-04 12:22:47 UTC (rev 80482)
@@ -0,0 +1,31 @@
+<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/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-cl</artifactId>
+ <version>2.0.0.CR5</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-cl-dist</artifactId>
+ <version>2.0.0.CR5</version>
+ <packaging>pom</packaging>
+ <name>JBoss ClassLoader Distribution Build</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss ClassLoader Distribution Build</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/dist.xml</descriptor>
+ <descriptor>src/assembly/src.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Deleted: projects/jboss-cl/tags/2.0.0.CR5/classloader/pom.xml
===================================================================
--- projects/jboss-cl/branches/Branch_2_0/classloader/pom.xml 2008-10-24 08:59:07 UTC (rev 80027)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloader/pom.xml 2008-11-04 12:22:47 UTC (rev 80482)
@@ -1,87 +0,0 @@
-<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/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-cl</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-classloader</artifactId>
- <packaging>jar</packaging>
- <name>JBoss ClassLoader</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss ClassLoader</description>
-
- <!-- Do not add version information here, use ../pom.xml instead -->
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <version>${version.org.jboss.test}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${version.junit}</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <!-- Global dependencies -->
- <dependency>
- <groupId>org.jboss.integration</groupId>
- <artifactId>jboss-classloading-spi</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- <exclusions>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-logging-spi</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-slide</groupId>
- <artifactId>webdavlib</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-xerces</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <optional>true</optional>
- </dependency>
-
- </dependencies>
-</project>
\ No newline at end of file
Copied: projects/jboss-cl/tags/2.0.0.CR5/classloader/pom.xml (from rev 80481, projects/jboss-cl/branches/Branch_2_0/classloader/pom.xml)
===================================================================
--- projects/jboss-cl/tags/2.0.0.CR5/classloader/pom.xml (rev 0)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloader/pom.xml 2008-11-04 12:22:47 UTC (rev 80482)
@@ -0,0 +1,87 @@
+<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/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-cl</artifactId>
+ <version>2.0.0.CR5</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-classloader</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss ClassLoader</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss ClassLoader</description>
+
+ <!-- Do not add version information here, use ../pom.xml instead -->
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>${version.org.jboss.test}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>org.jboss.integration</groupId>
+ <artifactId>jboss-classloading-spi</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>apache-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>apache-slide</groupId>
+ <artifactId>webdavlib</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>apache-xerces</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: projects/jboss-cl/tags/2.0.0.CR5/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 2008-10-24 08:59:07 UTC (rev 80027)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java 2008-11-04 12:22:47 UTC (rev 80482)
@@ -1,1037 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.base;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.CodeSource;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.security.ProtectionDomain;
-import java.security.SecureClassLoader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReentrantLock;
-
-import javax.management.ObjectName;
-
-import org.jboss.classloader.plugins.ClassLoaderUtils;
-import org.jboss.classloader.spi.ClassLoaderDomain;
-import org.jboss.classloader.spi.ClassLoaderPolicy;
-import org.jboss.classloader.spi.DelegateLoader;
-import org.jboss.classloader.spi.PackageInformation;
-import org.jboss.classloading.spi.RealClassLoader;
-import org.jboss.logging.Logger;
-import org.jboss.util.collection.Iterators;
-
-/**
- * BaseClassLoader.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class BaseClassLoader extends SecureClassLoader implements BaseClassLoaderMBean, RealClassLoader
-{
- /** The log */
- private static final Logger log = Logger.getLogger(BaseClassLoader.class);
-
- /** The lock object */
- private ReentrantLock lock = new ReentrantLock(true);
-
- /** The policy for this classloader */
- private ClassLoaderPolicy policy;
-
- /** Our Loader front end */
- private DelegateLoader loader;
-
- /** The loaded classes */
- private Map<String, String> loadedClasses = new ConcurrentHashMap<String, String>();
-
- /** Our resource cache */
- private Map<String, URL> resourceCache;
-
- /** Our black list */
- private Map<String, String> blackList;
-
- /** A cached version of toLongString() */
- private String cachedToString;
-
- /**
- * Create a new ClassLoader with no parent.
- *
- * @param policy the policy
- * @throws IllegalArgumentException for a null policy
- * @throws IllegalStateException if the policy is already associated with a classloader
- */
- public BaseClassLoader(ClassLoaderPolicy policy)
- {
- super(null);
- if (policy == null)
- throw new IllegalArgumentException("Null policy");
- this.policy = policy;
-
- BaseClassLoaderPolicy basePolicy = policy;
- basePolicy.setClassLoader(this);
-
- loader = new DelegateLoader(policy);
-
- if (basePolicy.isCacheable())
- resourceCache = new ConcurrentHashMap<String, URL>();
-
- if (basePolicy.isBlackListable())
- blackList = new ConcurrentHashMap<String, String>();
-
- log.debug("Created " + this + " with policy " + policy.toLongString());
- }
-
- public ObjectName getObjectName()
- {
- return policy.getObjectName();
- }
-
- public ObjectName getClassLoaderDomain()
- {
- BaseClassLoaderPolicy basePolicy = policy;
- ClassLoaderDomain domain = (ClassLoaderDomain) basePolicy.getClassLoaderDomain();
- return domain.getObjectName();
- }
-
- public String getName()
- {
- return policy.getName();
- }
-
- public boolean isBlackListable()
- {
- BaseClassLoaderPolicy basePolicy = policy;
- return basePolicy.isBlackListable();
- }
-
- public boolean isCacheable()
- {
- BaseClassLoaderPolicy basePolicy = policy;
- return basePolicy.isCacheable();
- }
-
- public boolean isImportAll()
- {
- BaseClassLoaderPolicy basePolicy = policy;
- return basePolicy.isImportAll();
- }
-
- public Set<String> listExportedPackages()
- {
- HashSet<String> result = new HashSet<String>();
- String[] packageNames = policy.getPackageNames();
- if (packageNames != null)
- Collections.addAll(result, packageNames);
- return result;
- }
-
- public List<ObjectName> listImports()
- {
- ArrayList<ObjectName> result = new ArrayList<ObjectName>();
- BaseClassLoaderPolicy basePolicy = policy;
- List<? extends DelegateLoader> delegates = basePolicy.getDelegates();
- if (delegates != null)
- {
- for (DelegateLoader delegate : delegates)
- {
- BaseDelegateLoader baseDelegate = delegate;
- BaseClassLoaderPolicy otherPolicy = baseDelegate.getPolicy();
- if (otherPolicy != null)
- result.add(otherPolicy.getObjectName());
- }
- }
- return result;
- }
-
- public String listPolicyDetails()
- {
- return policy.toLongString();
- }
-
- public ObjectName findClassLoaderForClass(String name) throws ClassNotFoundException
- {
- final Class<?> clazz = loadClass(name);
- if (clazz == null)
- return null;
-
- ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader run()
- {
- return clazz.getClassLoader();
- }
- });
-
- if (cl != null && cl instanceof RealClassLoader)
- return ((RealClassLoader) cl).getObjectName();
-
- return null;
- }
-
- public Set<String> listLoadedClasses()
- {
- return Collections.unmodifiableSet(loadedClasses.keySet());
- }
-
- public Set<String> listLoadedResourceNames()
- {
- if (resourceCache == null)
- return Collections.emptySet();
- return new HashSet<String>(resourceCache.keySet());
- }
-
- public Set<URL> listLoadedResources()
- {
- if (resourceCache == null)
- return Collections.emptySet();
- return new HashSet<URL>(resourceCache.values());
- }
-
- /**
- * Get the policy.
- *
- * @return the policy.
- */
- ClassLoaderPolicy getPolicy()
- {
- return policy;
- }
-
- /**
- * Get the loader.
- *
- * @return the loader.
- */
- DelegateLoader getLoader()
- {
- return loader;
- }
-
- @Override
- protected Package getPackage(String name)
- {
- boolean trace = log.isTraceEnabled();
- if (trace)
- log.trace(this + " getPackage " + name);
-
- if (name == null)
- return null;
-
- // Did we already load this package?
- Package result = super.getPackage(name);
- if (result != null && trace)
- log.trace(this + " already loaded package " + name + " " + result.getName());
-
- // Not already loaded use the domain
- if (result == null)
- {
- BaseClassLoaderPolicy basePolicy = policy;
- BaseClassLoaderDomain domain = basePolicy.getClassLoaderDomain();
- if (domain == null)
- return null;
- if (trace)
- log.trace(this + " getPackage " + name + " domain=" + domain);
- result = domain.getPackage(this, name);
- }
-
- // Still not found
- if (result == null)
- {
- if (trace)
- log.trace(this + " package not found " + name);
- }
-
- return result;
- }
-
- @Override
- protected Package[] getPackages()
- {
- BaseClassLoaderPolicy basePolicy = policy;
- BaseClassLoaderDomain domain = basePolicy.getClassLoaderDomain();
- if (domain == null)
- return super.getPackages();
- boolean trace = log.isTraceEnabled();
- if (trace)
- log.trace(this + " getPackages domain=" + domain);
-
- Set<Package> packages = new HashSet<Package>();
- domain.getPackages(this, packages);
- return packages.toArray(new Package[packages.size()]);
- }
-
- /**
- * Get a package locally
- *
- * @param name the package name
- * @return the package
- */
- Package getPackageLocally(String name)
- {
- return super.getPackage(name);
- }
-
- /**
- * Get the packages locally
- *
- * @param packages the packages
- */
- void getPackagesLocally(Set<Package> packages)
- {
- Package[] pkgs = super.getPackages();
- for (Package pkg : pkgs)
- packages.add(pkg);
- }
-
- /**
- * Check to see if the class is already loaded
- *
- * @param name the name of the class
- * @param trace whether trace is enabled
- * @return the class is if it is already loaded, null otherwise
- */
- protected Class<?> isLoadedClass(String name, boolean trace)
- {
- Class<?> result = findLoadedClass(name);
- if (result != null)
- {
- // Has this classloader been undeployed?
- ClassLoader otherClassLoader = getClassLoader(result);
- if (otherClassLoader != null && otherClassLoader != this && otherClassLoader instanceof RealClassLoader)
- {
- RealClassLoader rcl = (RealClassLoader) otherClassLoader;
- // Ignore when undeployed
- if (rcl.isValid() == false)
- {
- if (trace)
- log.trace(this + " ignoring already loaded class from undeployed classloader " + ClassLoaderUtils.classToString(result));
- result = null;
- }
- }
- }
- if (result != null && trace)
- log.trace(this + " already loaded class " + ClassLoaderUtils.classToString(result));
- return result;
- }
-
- @Override
- protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
- {
- boolean trace = log.isTraceEnabled();
- if (trace)
- log.trace(this + " loadClass " + name + " resolve=" + resolve);
-
- // Validate the class name makes sense
- ClassLoaderUtils.checkClassName(name);
-
- // Did we already load this class?
- Class<?> result = isLoadedClass(name, trace);
-
- // If this is an array, use Class.forName() to resolve it
- if (result == null && name.charAt(0) == '[')
- {
- if (trace)
- log.trace(this + " resolving array class " + name + " using Class.forName()");
- result = Class.forName(name, true, this);
- if (trace)
- log.trace(this + " resolved array " + ClassLoaderUtils.classToString(result));
- }
- if (result != null)
- return result;
-
- synchronized (this)
- {
- // Not already loaded use the domain
- if (result == null)
- result = loadClassFromDomain(name, trace);
-
- // Still not found
- if (result == null)
- {
- if (trace)
- log.trace(this + " class not found " + name);
- throw new ClassNotFoundException(name + " from " + toLongString());
- }
-
- // Link the class if requested
- if (resolve)
- {
- if (trace)
- log.trace(this + " resolveClass " + ClassLoaderUtils.classToString(result));
- resolveClass(result);
- }
-
- return result;
- }
- }
-
- @Override
- public URL getResource(String name)
- {
- BaseClassLoaderPolicy basePolicy = policy;
- BaseClassLoaderDomain domain = basePolicy.getClassLoaderDomain();
- boolean trace = log.isTraceEnabled();
- if (trace)
- log.trace(this + " getResource " + name + " domain=" + domain);
-
- if (domain != null)
- return domain.getResource(this, name);
- return null;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected Enumeration<URL> findResources(String name) throws IOException
- {
- Set<URL> resourceURLs = loadResources(name);
- return Iterators.toEnumeration(resourceURLs.iterator());
- }
-
- public Set<URL> loadResources(String name) throws IOException
- {
- BaseClassLoaderPolicy basePolicy = policy;
- BaseClassLoaderDomain domain = basePolicy.getClassLoaderDomain();
- boolean trace = log.isTraceEnabled();
- if (trace)
- log.trace(this + " findResources " + name + " domain=" + domain);
-
- Set<URL> resourceURLs = new HashSet<URL>();
- if (domain != null)
- domain.getResources(this, name, resourceURLs);
- return resourceURLs;
- }
-
- /**
- * Try to load the class locally
- *
- * @param name the class name
- * @return the class
- */
- Class<?> loadClassLocally(String name)
- {
- return loadClassLocally(name, log.isTraceEnabled());
- }
-
- /**
- * Try to load the class locally
- *
- * @param name the class name
- * @param trace whether trace is enabled
- * @return the class if found
- */
- synchronized Class<?> loadClassLocally(final String name, final boolean trace)
- {
- if (trace)
- log.trace(this + " load class locally " + name);
-
- // This is really a double check but the request may not have entered through loadClass on this classloader
- Class<?> result = isLoadedClass(name, trace);
- if (result != null)
- return result;
-
- // Look for the resource
- final String resourcePath = ClassLoaderUtils.classNameToPath(name);
-
- result = AccessController.doPrivileged(new PrivilegedAction<Class<?>>()
- {
- public Class<?> run()
- {
- InputStream is = policy.getResourceAsStream(resourcePath);
- if (is == null)
- {
- if (trace)
- BaseClassLoader.log.trace(BaseClassLoader.this + " resource not found locally " + resourcePath + " for " + name);
- return null;
- }
-
- // Load the bytecode
- byte[] byteCode = ClassLoaderUtils.loadByteCode(name, is);
-
- // Let the policy do things before we define the class
- BaseClassLoaderPolicy basePolicy = policy;
- ProtectionDomain protectionDomain = basePolicy.getProtectionDomain(name, resourcePath);
- try
- {
- byte[] transformed = policy.transform(name, byteCode, protectionDomain);
- if (transformed != null)
- byteCode = transformed;
- }
- catch (Throwable t)
- {
- throw new RuntimeException("Unexpected error transforming class " + name, t);
- }
-
- // Create the package if necessary
- URL codeSourceURL = null;
- if (protectionDomain != null)
- {
- CodeSource codeSource = protectionDomain.getCodeSource();
- if (codeSource != null)
- codeSourceURL = codeSource.getLocation();
- }
- definePackage(name, codeSourceURL);
-
- // Finally we can define the class
- Class<?> result;
- if (protectionDomain != null)
- result = defineClass(name, byteCode, 0, byteCode.length, protectionDomain);
- else
- result = defineClass(name, byteCode, 0, byteCode.length);
- if (trace)
- BaseClassLoader.log.trace(BaseClassLoader.this + " loaded class locally " + ClassLoaderUtils.classToString(result));
- return result;
- }
- }, policy.getAccessControlContext());
-
- loadedClasses.put(name, name);
-
- return result;
- }
-
- /**
- * Try to find the resource locally
- *
- * @param name the resource name
- * @return the url if found
- */
- public URL getResourceLocally(String name)
- {
- return getResourceLocally(name, log.isTraceEnabled());
- }
-
- /**
- * Try to find the resource locally
- *
- * @param name the resource name
- * @param trace whether trace is enabled
- * @return the URL if found
- */
- URL getResourceLocally(final String name, final boolean trace)
- {
- if (trace)
- log.trace(this + " get resource locally " + name);
-
- // Do we already know the answer?
- if (resourceCache != null)
- {
- URL url = resourceCache.get(name);
- if (url != null)
- {
- if (trace)
- log.trace(this + " got resource from cache " + name);
- return url;
- }
- }
-
- // Is this resource blacklisted?
- if (blackList != null && blackList.containsKey(name))
- {
- if (trace)
- log.trace(this + " resource is blacklisted " + name);
- return null;
- }
-
- // Ask the policy for the resource
- URL result = AccessController.doPrivileged(new PrivilegedAction<URL>()
- {
- public URL run()
- {
- // Look for the resource
- URL result = policy.getResource(name);
- if (result == null)
- {
- if (trace)
- BaseClassLoader.log.trace(BaseClassLoader.this + " resource not found locally " + name);
- return null;
- }
- if (trace)
- BaseClassLoader.log.trace(BaseClassLoader.this + " got resource locally " + name);
- return result;
- }
- }, policy.getAccessControlContext());
-
- // Cache what we found
- if (resourceCache != null && result != null)
- resourceCache.put(name, result);
-
- // Blacklist when not found
- if (blackList != null && result == null)
- blackList.put(name, name);
-
- return result;
- }
-
- /**
- * Try to find the resource locally
- *
- * @param name the resource name
- * @param urls the urls to add to
- * @throws IOException for any error
- */
- void getResourcesLocally(String name, Set<URL> urls) throws IOException
- {
- getResourcesLocally(name, urls, log.isTraceEnabled());
- }
-
- /**
- * Try to find the resources locally
- *
- * @param name the resource name
- * @param urls the urls to add to
- * @param trace whether trace is enabled
- * @throws IOException for any error
- */
- void getResourcesLocally(final String name, final Set<URL> urls, boolean trace) throws IOException
- {
- if (trace)
- log.trace(this + " get resources locally " + name);
-
- // Look for the resources
- try
- {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- policy.getResources(name, urls);
- return null;
- }
- }, policy.getAccessControlContext());
- }
- catch (PrivilegedActionException e)
- {
- Exception e1 = e.getException();
- if (e1 instanceof RuntimeException)
- throw (RuntimeException) e1;
- if (e1 instanceof IOException)
- throw (IOException) e1;
- IOException e2 = new IOException("Unexpected error");
- e2.initCause(e1);
- throw e2;
- }
- }
-
- /**
- * Define the package for the class if not already done
- *
- * @param className the class name
- * @param codeSourceURL the code source url
- */
- protected void definePackage(String className, URL codeSourceURL)
- {
- String packageName = ClassLoaderUtils.getClassPackageName(className);
- if (packageName.length() == 0)
- return;
-
- // Ask the policy for the information
- PackageInformation pi = policy.getClassPackageInformation(className, packageName);
-
- // Already defined?
- Package pkge = getPackage(packageName);
- if (pkge != null)
- {
- // Check sealing
- if (pkge.isSealed())
- {
- // Are we trying to add outside the seal?
- if (codeSourceURL == null || pkge.isSealed(codeSourceURL) == false)
- throw new SecurityException("Sealing violation for package " + packageName);
- }
- // Can we seal now?
- else if (pi != null && pi.sealBase != null)
- {
- throw new SecurityException("Can't seal package " + packageName +" it is already loaded");
- }
- return;
- }
-
- try
- {
- if (pi != null)
- definePackage(packageName, pi.specTitle, pi.specVersion, pi.specVendor, pi.implTitle, pi.implVersion, pi.implVendor, pi.sealBase);
- else
- definePackage(packageName, null, null, null, null, null, null, null);
- if (log.isTraceEnabled())
- log.trace(this + " defined package: " + packageName);
- }
- catch (IllegalArgumentException alreadyDone)
- {
- // The package has already been defined
- }
- }
-
- /**
- * Try to load the class from the domain
- *
- * @param name the class name
- * @param trace whether trace is enabled
- * @return the class if found in the parent
- * @throws ClassNotFoundException for any error
- */
- protected Class<?> loadClassFromDomain(String name, boolean trace) throws ClassNotFoundException
- {
- // Because of the broken classloading in the Sun JDK we need to
- // serialize access to the classloader.
-
- // Additionally, acquiring the lock on the policy for this classloader
- // ensures that we don't race with somebody undeploying the classloader
- // which could cause leaks
- acquireLockFairly(trace);
- try
- {
- // Here we have synchronized with the policy
- BaseClassLoaderPolicy basePolicy = policy;
- BaseClassLoaderDomain domain = basePolicy.getClassLoaderDomain();
-
- if (trace)
- log.trace(this + " load from domain " + name + " domain=" + domain);
-
- // No domain, try to load the class locally
- // this could happen during undeployment of the classloader
- // where something needs a local class after it is has been unhooked from the system
- if (domain == null)
- {
- Class<?> result = loadClassLocally(name, trace);
-
- // So this is almost certainly a classloader leak
- if (result == null)
- throw new IllegalStateException(this + " classLoader is not connected to a domain (probably undeployed?) for class " + name);
- return result;
- }
-
- // Ask the domain to load the class in the context of our classloader/policy
- Class<?> result = domain.loadClass(this, name);
- if (result != null && trace)
- log.trace(this + " got class from domain " + ClassLoaderUtils.classToString(result));
- return result;
- }
- finally
- {
- unlock(trace);
- }
- }
-
- public boolean isValid()
- {
- BaseClassLoaderPolicy basePolicy = policy;
- return basePolicy.getClassLoaderUnchecked() != null;
- }
-
- public Class<?> getCachedClass(String name)
- {
- // TODO look in global and/or local cache
- return null;
- }
-
- public URL getCachedResource(String name)
- {
- // TODO look in global and/or local cache
- return null;
- }
-
- public int getResourceBlackListSize()
- {
- Map<String, String> blackList = this.blackList;
- if (blackList == null)
- return 0;
- return blackList.size();
- }
-
- public int getResourceCacheSize()
- {
- Map<String, URL> resourceCache = this.resourceCache;
- if (resourceCache == null)
- return 0;
- return resourceCache.size();
- }
-
- public Set<String> listResourceBlackList()
- {
- Map<String, String> blackList = this.blackList;
- if (blackList == null)
- return Collections.emptySet();
- return Collections.unmodifiableSet(blackList.keySet());
- }
-
- public Map<String, URL> listResourceCache()
- {
- Map<String, URL> resourceCache = this.resourceCache;
- if (resourceCache == null)
- return Collections.emptyMap();
- return Collections.unmodifiableMap(resourceCache);
- }
-
- public void clearBlackList()
- {
- if (blackList != null)
- {
- for (String name : blackList.keySet())
- clearBlackList(name);
- }
- }
-
- public void clearBlackList(String name)
- {
- if (blackList != null)
- {
- boolean trace = log.isTraceEnabled();
- if (trace)
- log.trace(this + " removing from blacklist " + name);
- blackList.remove(name);
- policy.clearBlackList(name);
- }
- }
-
- /**
- * A long version of the classloader
- *
- * @return the long string
- */
- public String toLongString()
- {
- if (cachedToString != null)
- return cachedToString;
-
- StringBuilder builder = new StringBuilder();
- builder.append(getClass().getSimpleName());
- builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
- builder.append('{').append(getPolicy().toLongString());
- toLongString(builder);
- builder.append('}');
- cachedToString = builder.toString();
- return cachedToString;
- }
-
- /**
- * Shutdown the classloader
- */
- protected void shutdownClassLoader()
- {
- log.debug(toString() + " shutdown!");
- if (resourceCache != null)
- resourceCache.clear();
- if (blackList != null)
- blackList.clear();
- cachedToString = null;
- }
-
- /**
- * For subclasses to add things to the long string
- *
- * @param builder the builder
- */
- protected void toLongString(StringBuilder builder)
- {
- }
-
- @Override
- public String toString()
- {
- StringBuilder builder = new StringBuilder();
- builder.append(getClass().getSimpleName());
- builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
- builder.append("{").append(policy.getName()).append("}");
- return builder.toString();
- }
-
- /**
- * Attempt to lock, but don't wait
- *
- * @return true when the lock was obtained
- */
- boolean attemptLock()
- {
- return attemptLock(log.isTraceEnabled());
- }
-
- /**
- * Lock
- *
- * This method must be invoked with the monitor held
- */
- void lock()
- {
- acquireLockFairly(log.isTraceEnabled());
- }
-
- /**
- * Unlock
- */
- void unlock()
- {
- unlock(log.isTraceEnabled());
- }
-
- /**
- * Attempt to get the lock but don't wait
- *
- * @param trace whether trace is enabled
- * @return true when obtained the lock
- */
- private boolean attemptLock(boolean trace)
- {
- Thread thread = Thread.currentThread();
- if (trace)
- log.trace(this + " attemptLock " + thread);
-
- boolean interrupted = Thread.interrupted();
-
- boolean result = false;
- try
- {
- result = lock.tryLock(0, TimeUnit.MICROSECONDS);
- }
- catch (InterruptedException ignored)
- {
- }
- finally
- {
- if (interrupted)
- thread.interrupt();
- }
- if (trace)
- {
- if (result)
- log.trace(this + " locked " + thread + " holding=" + lock.getHoldCount());
- else
- log.trace(this + " did NOT get the lock " + thread);
- }
-
- // We got the lock so we own it
- if (result && lock.getHoldCount() == 1)
- ClassLoaderManager.registerLoaderThread(this, thread);
-
- return result;
- }
-
- /**
- * Acquire the lock on the classloader fairly<p>
- *
- * This must be invoked with the monitor held
- *
- * @param trace whether trace is enabled
- */
- private void acquireLockFairly(boolean trace)
- {
- Thread thread = Thread.currentThread();
- if (trace)
- log.trace(this + " aquireLockFairly " + thread);
-
- boolean interrupted = Thread.interrupted();
-
- int waits = 0;
-
- try
- {
- while (true)
- {
- try
- {
- if (lock.tryLock(0, TimeUnit.MICROSECONDS) == false)
- {
- // Two minutes should be long enough?
- if (waits++ == 12)
- throw new IllegalStateException("Waiting too long to get the classloader lock: " + this);
- // Wait 10 seconds
- if (trace)
- log.trace(this + " waiting for lock " + thread);
- this.wait(10000);
- }
- else
- {
- if (trace)
- log.trace(this + " aquiredLock " + thread + " holding=" + lock.getHoldCount());
- break;
- }
- }
- catch (InterruptedException ignored)
- {
- }
- }
- }
- finally
- {
- if (interrupted)
- thread.interrupt();
- }
-
- if (lock.getHoldCount() == 1)
- ClassLoaderManager.registerLoaderThread(this, thread);
- }
-
- /**
- * Unlock
- *
- * @param trace whether trace is enabled
- */
- private void unlock(boolean trace)
- {
- Thread thread = Thread.currentThread();
- if (trace)
- log.trace(this + " unlock " + thread + " holding=" + lock.getHoldCount());
-
- synchronized (this)
- {
- lock.unlock();
-
- if (lock.getHoldCount() == 0)
- {
- ClassLoaderManager.unregisterLoaderThread(this, thread);
- notifyAll();
- }
- }
- }
-
- /**
- * Get the classloader for a class
- *
- * @param clazz the class
- * @return the classloader or null if it doesn't have one
- */
- private static final ClassLoader getClassLoader(final Class<?> clazz)
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- return clazz.getClassLoader();
-
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader run()
- {
- return clazz.getClassLoader();
- }
- });
- }
-}
Copied: projects/jboss-cl/tags/2.0.0.CR5/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java (from rev 80479, projects/jboss-cl/branches/Branch_2_0/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java)
===================================================================
--- projects/jboss-cl/tags/2.0.0.CR5/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java (rev 0)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloader/src/main/java/org/jboss/classloader/spi/base/BaseClassLoader.java 2008-11-04 12:22:47 UTC (rev 80482)
@@ -0,0 +1,1037 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.base;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.CodeSource;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.security.ProtectionDomain;
+import java.security.SecureClassLoader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.management.ObjectName;
+
+import org.jboss.classloader.plugins.ClassLoaderUtils;
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloader.spi.ClassLoaderPolicy;
+import org.jboss.classloader.spi.DelegateLoader;
+import org.jboss.classloader.spi.PackageInformation;
+import org.jboss.classloading.spi.RealClassLoader;
+import org.jboss.logging.Logger;
+import org.jboss.util.collection.Iterators;
+
+/**
+ * BaseClassLoader.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class BaseClassLoader extends SecureClassLoader implements BaseClassLoaderMBean, RealClassLoader
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(BaseClassLoader.class);
+
+ /** The lock object */
+ private ReentrantLock lock = new ReentrantLock(true);
+
+ /** The policy for this classloader */
+ private ClassLoaderPolicy policy;
+
+ /** Our Loader front end */
+ private DelegateLoader loader;
+
+ /** The loaded classes */
+ private Map<String, String> loadedClasses = new ConcurrentHashMap<String, String>();
+
+ /** Our resource cache */
+ private Map<String, URL> resourceCache;
+
+ /** Our black list */
+ private Map<String, String> blackList;
+
+ /** A cached version of toLongString() */
+ private String cachedToString;
+
+ /**
+ * Create a new ClassLoader with no parent.
+ *
+ * @param policy the policy
+ * @throws IllegalArgumentException for a null policy
+ * @throws IllegalStateException if the policy is already associated with a classloader
+ */
+ public BaseClassLoader(ClassLoaderPolicy policy)
+ {
+ super(null);
+ if (policy == null)
+ throw new IllegalArgumentException("Null policy");
+ this.policy = policy;
+
+ BaseClassLoaderPolicy basePolicy = policy;
+ basePolicy.setClassLoader(this);
+
+ loader = new DelegateLoader(policy);
+
+ if (basePolicy.isCacheable())
+ resourceCache = new ConcurrentHashMap<String, URL>();
+
+ if (basePolicy.isBlackListable())
+ blackList = new ConcurrentHashMap<String, String>();
+
+ log.debug("Created " + this + " with policy " + policy.toLongString());
+ }
+
+ public ObjectName getObjectName()
+ {
+ return policy.getObjectName();
+ }
+
+ public ObjectName getClassLoaderDomain()
+ {
+ BaseClassLoaderPolicy basePolicy = policy;
+ ClassLoaderDomain domain = (ClassLoaderDomain) basePolicy.getClassLoaderDomain();
+ return domain.getObjectName();
+ }
+
+ public String getName()
+ {
+ return policy.getName();
+ }
+
+ public boolean isBlackListable()
+ {
+ BaseClassLoaderPolicy basePolicy = policy;
+ return basePolicy.isBlackListable();
+ }
+
+ public boolean isCacheable()
+ {
+ BaseClassLoaderPolicy basePolicy = policy;
+ return basePolicy.isCacheable();
+ }
+
+ public boolean isImportAll()
+ {
+ BaseClassLoaderPolicy basePolicy = policy;
+ return basePolicy.isImportAll();
+ }
+
+ public Set<String> listExportedPackages()
+ {
+ HashSet<String> result = new HashSet<String>();
+ String[] packageNames = policy.getPackageNames();
+ if (packageNames != null)
+ Collections.addAll(result, packageNames);
+ return result;
+ }
+
+ public List<ObjectName> listImports()
+ {
+ ArrayList<ObjectName> result = new ArrayList<ObjectName>();
+ BaseClassLoaderPolicy basePolicy = policy;
+ List<? extends DelegateLoader> delegates = basePolicy.getDelegates();
+ if (delegates != null)
+ {
+ for (DelegateLoader delegate : delegates)
+ {
+ BaseDelegateLoader baseDelegate = delegate;
+ BaseClassLoaderPolicy otherPolicy = baseDelegate.getPolicy();
+ if (otherPolicy != null)
+ result.add(otherPolicy.getObjectName());
+ }
+ }
+ return result;
+ }
+
+ public String listPolicyDetails()
+ {
+ return policy.toLongString();
+ }
+
+ public ObjectName findClassLoaderForClass(String name) throws ClassNotFoundException
+ {
+ final Class<?> clazz = loadClass(name);
+ if (clazz == null)
+ return null;
+
+ ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return clazz.getClassLoader();
+ }
+ });
+
+ if (cl != null && cl instanceof RealClassLoader)
+ return ((RealClassLoader) cl).getObjectName();
+
+ return null;
+ }
+
+ public Set<String> listLoadedClasses()
+ {
+ return Collections.unmodifiableSet(loadedClasses.keySet());
+ }
+
+ public Set<String> listLoadedResourceNames()
+ {
+ if (resourceCache == null)
+ return Collections.emptySet();
+ return new HashSet<String>(resourceCache.keySet());
+ }
+
+ public Set<URL> listLoadedResources()
+ {
+ if (resourceCache == null)
+ return Collections.emptySet();
+ return new HashSet<URL>(resourceCache.values());
+ }
+
+ /**
+ * Get the policy.
+ *
+ * @return the policy.
+ */
+ ClassLoaderPolicy getPolicy()
+ {
+ return policy;
+ }
+
+ /**
+ * Get the loader.
+ *
+ * @return the loader.
+ */
+ DelegateLoader getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ protected Package getPackage(String name)
+ {
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ log.trace(this + " getPackage " + name);
+
+ if (name == null)
+ return null;
+
+ // Did we already load this package?
+ Package result = super.getPackage(name);
+ if (result != null && trace)
+ log.trace(this + " already loaded package " + name + " " + result.getName());
+
+ // Not already loaded use the domain
+ if (result == null)
+ {
+ BaseClassLoaderPolicy basePolicy = policy;
+ BaseClassLoaderDomain domain = basePolicy.getClassLoaderDomain();
+ if (domain == null)
+ return null;
+ if (trace)
+ log.trace(this + " getPackage " + name + " domain=" + domain);
+ result = domain.getPackage(this, name);
+ }
+
+ // Still not found
+ if (result == null)
+ {
+ if (trace)
+ log.trace(this + " package not found " + name);
+ }
+
+ return result;
+ }
+
+ @Override
+ protected Package[] getPackages()
+ {
+ BaseClassLoaderPolicy basePolicy = policy;
+ BaseClassLoaderDomain domain = basePolicy.getClassLoaderDomain();
+ if (domain == null)
+ return super.getPackages();
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ log.trace(this + " getPackages domain=" + domain);
+
+ Set<Package> packages = new HashSet<Package>();
+ domain.getPackages(this, packages);
+ return packages.toArray(new Package[packages.size()]);
+ }
+
+ /**
+ * Get a package locally
+ *
+ * @param name the package name
+ * @return the package
+ */
+ Package getPackageLocally(String name)
+ {
+ return super.getPackage(name);
+ }
+
+ /**
+ * Get the packages locally
+ *
+ * @param packages the packages
+ */
+ void getPackagesLocally(Set<Package> packages)
+ {
+ Package[] pkgs = super.getPackages();
+ for (Package pkg : pkgs)
+ packages.add(pkg);
+ }
+
+ /**
+ * Check to see if the class is already loaded
+ *
+ * @param name the name of the class
+ * @param trace whether trace is enabled
+ * @return the class is if it is already loaded, null otherwise
+ */
+ protected Class<?> isLoadedClass(String name, boolean trace)
+ {
+ Class<?> result = findLoadedClass(name);
+ if (result != null)
+ {
+ // Has this classloader been undeployed?
+ ClassLoader otherClassLoader = getClassLoader(result);
+ if (otherClassLoader != null && otherClassLoader != this && otherClassLoader instanceof RealClassLoader)
+ {
+ RealClassLoader rcl = (RealClassLoader) otherClassLoader;
+ // Ignore when undeployed
+ if (rcl.isValid() == false)
+ {
+ if (trace)
+ log.trace(this + " ignoring already loaded class from undeployed classloader " + ClassLoaderUtils.classToString(result));
+ result = null;
+ }
+ }
+ }
+ if (result != null && trace)
+ log.trace(this + " already loaded class " + ClassLoaderUtils.classToString(result));
+ return result;
+ }
+
+ @Override
+ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
+ {
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ log.trace(this + " loadClass " + name + " resolve=" + resolve);
+
+ // Validate the class name makes sense
+ ClassLoaderUtils.checkClassName(name);
+
+ // Did we already load this class?
+ Class<?> result = isLoadedClass(name, trace);
+
+ // If this is an array, use Class.forName() to resolve it
+ if (result == null && name.charAt(0) == '[')
+ {
+ if (trace)
+ log.trace(this + " resolving array class " + name + " using Class.forName()");
+ result = Class.forName(name, true, this);
+ if (trace)
+ log.trace(this + " resolved array " + ClassLoaderUtils.classToString(result));
+ }
+ if (result != null)
+ return result;
+
+ synchronized (this)
+ {
+ // Not already loaded use the domain
+ if (result == null)
+ result = loadClassFromDomain(name, trace);
+
+ // Still not found
+ if (result == null)
+ {
+ if (trace)
+ log.trace(this + " class not found " + name);
+ throw new ClassNotFoundException(name + " from " + toLongString());
+ }
+
+ // Link the class if requested
+ if (resolve)
+ {
+ if (trace)
+ log.trace(this + " resolveClass " + ClassLoaderUtils.classToString(result));
+ resolveClass(result);
+ }
+
+ return result;
+ }
+ }
+
+ @Override
+ public URL getResource(String name)
+ {
+ BaseClassLoaderPolicy basePolicy = policy;
+ BaseClassLoaderDomain domain = basePolicy.getClassLoaderDomain();
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ log.trace(this + " getResource " + name + " domain=" + domain);
+
+ if (domain != null)
+ return domain.getResource(this, name);
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected Enumeration<URL> findResources(String name) throws IOException
+ {
+ Set<URL> resourceURLs = loadResources(name);
+ return Iterators.toEnumeration(resourceURLs.iterator());
+ }
+
+ public Set<URL> loadResources(String name) throws IOException
+ {
+ BaseClassLoaderPolicy basePolicy = policy;
+ BaseClassLoaderDomain domain = basePolicy.getClassLoaderDomain();
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ log.trace(this + " findResources " + name + " domain=" + domain);
+
+ Set<URL> resourceURLs = new HashSet<URL>();
+ if (domain != null)
+ domain.getResources(this, name, resourceURLs);
+ return resourceURLs;
+ }
+
+ /**
+ * Try to load the class locally
+ *
+ * @param name the class name
+ * @return the class
+ */
+ Class<?> loadClassLocally(String name)
+ {
+ return loadClassLocally(name, log.isTraceEnabled());
+ }
+
+ /**
+ * Try to load the class locally
+ *
+ * @param name the class name
+ * @param trace whether trace is enabled
+ * @return the class if found
+ */
+ synchronized Class<?> loadClassLocally(final String name, final boolean trace)
+ {
+ if (trace)
+ log.trace(this + " load class locally " + name);
+
+ // This is really a double check but the request may not have entered through loadClass on this classloader
+ Class<?> result = isLoadedClass(name, trace);
+ if (result != null)
+ return result;
+
+ // Look for the resource
+ final String resourcePath = ClassLoaderUtils.classNameToPath(name);
+
+ result = AccessController.doPrivileged(new PrivilegedAction<Class<?>>()
+ {
+ public Class<?> run()
+ {
+ InputStream is = policy.getResourceAsStream(resourcePath);
+ if (is == null)
+ {
+ if (trace)
+ BaseClassLoader.log.trace(BaseClassLoader.this + " resource not found locally " + resourcePath + " for " + name);
+ return null;
+ }
+
+ // Load the bytecode
+ byte[] byteCode = ClassLoaderUtils.loadByteCode(name, is);
+
+ // Let the policy do things before we define the class
+ BaseClassLoaderPolicy basePolicy = policy;
+ ProtectionDomain protectionDomain = basePolicy.getProtectionDomain(name, resourcePath);
+ try
+ {
+ byte[] transformed = policy.transform(name, byteCode, protectionDomain);
+ if (transformed != null)
+ byteCode = transformed;
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException("Unexpected error transforming class " + name, t);
+ }
+
+ // Create the package if necessary
+ URL codeSourceURL = null;
+ if (protectionDomain != null)
+ {
+ CodeSource codeSource = protectionDomain.getCodeSource();
+ if (codeSource != null)
+ codeSourceURL = codeSource.getLocation();
+ }
+ definePackage(name, codeSourceURL);
+
+ // Finally we can define the class
+ Class<?> result;
+ if (protectionDomain != null)
+ result = defineClass(name, byteCode, 0, byteCode.length, protectionDomain);
+ else
+ result = defineClass(name, byteCode, 0, byteCode.length);
+ if (trace)
+ BaseClassLoader.log.trace(BaseClassLoader.this + " loaded class locally " + ClassLoaderUtils.classToString(result));
+ return result;
+ }
+ }, policy.getAccessControlContext());
+
+ loadedClasses.put(name, name);
+
+ return result;
+ }
+
+ /**
+ * Try to find the resource locally
+ *
+ * @param name the resource name
+ * @return the url if found
+ */
+ public URL getResourceLocally(String name)
+ {
+ return getResourceLocally(name, log.isTraceEnabled());
+ }
+
+ /**
+ * Try to find the resource locally
+ *
+ * @param name the resource name
+ * @param trace whether trace is enabled
+ * @return the URL if found
+ */
+ URL getResourceLocally(final String name, final boolean trace)
+ {
+ if (trace)
+ log.trace(this + " get resource locally " + name);
+
+ // Do we already know the answer?
+ if (resourceCache != null)
+ {
+ URL url = resourceCache.get(name);
+ if (url != null)
+ {
+ if (trace)
+ log.trace(this + " got resource from cache " + name);
+ return url;
+ }
+ }
+
+ // Is this resource blacklisted?
+ if (blackList != null && blackList.containsKey(name))
+ {
+ if (trace)
+ log.trace(this + " resource is blacklisted " + name);
+ return null;
+ }
+
+ // Ask the policy for the resource
+ URL result = AccessController.doPrivileged(new PrivilegedAction<URL>()
+ {
+ public URL run()
+ {
+ // Look for the resource
+ URL result = policy.getResource(name);
+ if (result == null)
+ {
+ if (trace)
+ BaseClassLoader.log.trace(BaseClassLoader.this + " resource not found locally " + name);
+ return null;
+ }
+ if (trace)
+ BaseClassLoader.log.trace(BaseClassLoader.this + " got resource locally " + name);
+ return result;
+ }
+ }, policy.getAccessControlContext());
+
+ // Cache what we found
+ if (resourceCache != null && result != null)
+ resourceCache.put(name, result);
+
+ // Blacklist when not found
+ if (blackList != null && result == null)
+ blackList.put(name, name);
+
+ return result;
+ }
+
+ /**
+ * Try to find the resource locally
+ *
+ * @param name the resource name
+ * @param urls the urls to add to
+ * @throws IOException for any error
+ */
+ void getResourcesLocally(String name, Set<URL> urls) throws IOException
+ {
+ getResourcesLocally(name, urls, log.isTraceEnabled());
+ }
+
+ /**
+ * Try to find the resources locally
+ *
+ * @param name the resource name
+ * @param urls the urls to add to
+ * @param trace whether trace is enabled
+ * @throws IOException for any error
+ */
+ void getResourcesLocally(final String name, final Set<URL> urls, boolean trace) throws IOException
+ {
+ if (trace)
+ log.trace(this + " get resources locally " + name);
+
+ // Look for the resources
+ try
+ {
+ AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
+ {
+ public Object run() throws Exception
+ {
+ policy.getResources(name, urls);
+ return null;
+ }
+ }, policy.getAccessControlContext());
+ }
+ catch (PrivilegedActionException e)
+ {
+ Exception e1 = e.getException();
+ if (e1 instanceof RuntimeException)
+ throw (RuntimeException) e1;
+ if (e1 instanceof IOException)
+ throw (IOException) e1;
+ IOException e2 = new IOException("Unexpected error");
+ e2.initCause(e1);
+ throw e2;
+ }
+ }
+
+ /**
+ * Define the package for the class if not already done
+ *
+ * @param className the class name
+ * @param codeSourceURL the code source url
+ */
+ protected void definePackage(String className, URL codeSourceURL)
+ {
+ String packageName = ClassLoaderUtils.getClassPackageName(className);
+ if (packageName.length() == 0)
+ return;
+
+ // Ask the policy for the information
+ PackageInformation pi = policy.getClassPackageInformation(className, packageName);
+
+ // Already defined?
+ Package pkge = getPackage(packageName);
+ if (pkge != null)
+ {
+ // Check sealing
+ if (pkge.isSealed())
+ {
+ // Are we trying to add outside the seal?
+ if (codeSourceURL == null || pkge.isSealed(codeSourceURL) == false)
+ throw new SecurityException("Sealing violation for package " + packageName);
+ }
+ // Can we seal now?
+ else if (pi != null && pi.sealBase != null)
+ {
+ throw new SecurityException("Can't seal package " + packageName +" it is already loaded");
+ }
+ return;
+ }
+
+ try
+ {
+ if (pi != null)
+ definePackage(packageName, pi.specTitle, pi.specVersion, pi.specVendor, pi.implTitle, pi.implVersion, pi.implVendor, pi.sealBase);
+ else
+ definePackage(packageName, null, null, null, null, null, null, null);
+ if (log.isTraceEnabled())
+ log.trace(this + " defined package: " + packageName);
+ }
+ catch (IllegalArgumentException alreadyDone)
+ {
+ // The package has already been defined
+ }
+ }
+
+ /**
+ * Try to load the class from the domain
+ *
+ * @param name the class name
+ * @param trace whether trace is enabled
+ * @return the class if found in the parent
+ * @throws ClassNotFoundException for any error
+ */
+ protected Class<?> loadClassFromDomain(String name, boolean trace) throws ClassNotFoundException
+ {
+ // Because of the broken classloading in the Sun JDK we need to
+ // serialize access to the classloader.
+
+ // Additionally, acquiring the lock on the policy for this classloader
+ // ensures that we don't race with somebody undeploying the classloader
+ // which could cause leaks
+ acquireLockFairly(trace);
+ try
+ {
+ // Here we have synchronized with the policy
+ BaseClassLoaderPolicy basePolicy = policy;
+ BaseClassLoaderDomain domain = basePolicy.getClassLoaderDomain();
+
+ if (trace)
+ log.trace(this + " load from domain " + name + " domain=" + domain);
+
+ // No domain, try to load the class locally
+ // this could happen during undeployment of the classloader
+ // where something needs a local class after it is has been unhooked from the system
+ if (domain == null)
+ {
+ Class<?> result = loadClassLocally(name, trace);
+
+ // So this is almost certainly a classloader leak
+ if (result == null)
+ throw new IllegalStateException(this + " classLoader is not connected to a domain (probably undeployed?) for class " + name);
+ return result;
+ }
+
+ // Ask the domain to load the class in the context of our classloader/policy
+ Class<?> result = domain.loadClass(this, name);
+ if (result != null && trace)
+ log.trace(this + " got class from domain " + ClassLoaderUtils.classToString(result));
+ return result;
+ }
+ finally
+ {
+ unlock(trace);
+ }
+ }
+
+ public boolean isValid()
+ {
+ BaseClassLoaderPolicy basePolicy = policy;
+ return basePolicy.getClassLoaderUnchecked() != null;
+ }
+
+ public Class<?> getCachedClass(String name)
+ {
+ // TODO look in global and/or local cache
+ return null;
+ }
+
+ public URL getCachedResource(String name)
+ {
+ // TODO look in global and/or local cache
+ return null;
+ }
+
+ public int getResourceBlackListSize()
+ {
+ Map<String, String> blackList = this.blackList;
+ if (blackList == null)
+ return 0;
+ return blackList.size();
+ }
+
+ public int getResourceCacheSize()
+ {
+ Map<String, URL> resourceCache = this.resourceCache;
+ if (resourceCache == null)
+ return 0;
+ return resourceCache.size();
+ }
+
+ public Set<String> listResourceBlackList()
+ {
+ Map<String, String> blackList = this.blackList;
+ if (blackList == null)
+ return Collections.emptySet();
+ return Collections.unmodifiableSet(blackList.keySet());
+ }
+
+ public Map<String, URL> listResourceCache()
+ {
+ Map<String, URL> resourceCache = this.resourceCache;
+ if (resourceCache == null)
+ return Collections.emptyMap();
+ return Collections.unmodifiableMap(resourceCache);
+ }
+
+ public void clearBlackList()
+ {
+ if (blackList != null)
+ {
+ for (String name : blackList.keySet())
+ clearBlackList(name);
+ }
+ }
+
+ public void clearBlackList(String name)
+ {
+ if (blackList != null)
+ {
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ log.trace(this + " removing from blacklist " + name);
+ blackList.remove(name);
+ policy.clearBlackList(name);
+ }
+ }
+
+ /**
+ * A long version of the classloader
+ *
+ * @return the long string
+ */
+ public String toLongString()
+ {
+ if (cachedToString != null)
+ return cachedToString;
+
+ StringBuilder builder = new StringBuilder();
+ builder.append(getClass().getSimpleName());
+ builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+ builder.append('{').append(getPolicy().toLongString());
+ toLongString(builder);
+ builder.append('}');
+ cachedToString = builder.toString();
+ return cachedToString;
+ }
+
+ /**
+ * Shutdown the classloader
+ */
+ protected void shutdownClassLoader()
+ {
+ log.debug(toString() + " shutdown!");
+ if (resourceCache != null)
+ resourceCache.clear();
+ if (blackList != null)
+ blackList.clear();
+ cachedToString = null;
+ }
+
+ /**
+ * For subclasses to add things to the long string
+ *
+ * @param builder the builder
+ */
+ protected void toLongString(StringBuilder builder)
+ {
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getClass().getSimpleName());
+ builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+ builder.append("{").append(policy.getName()).append("}");
+ return builder.toString();
+ }
+
+ /**
+ * Attempt to lock, but don't wait
+ *
+ * @return true when the lock was obtained
+ */
+ boolean attemptLock()
+ {
+ return attemptLock(log.isTraceEnabled());
+ }
+
+ /**
+ * Lock
+ *
+ * This method must be invoked with the monitor held
+ */
+ void lock()
+ {
+ acquireLockFairly(log.isTraceEnabled());
+ }
+
+ /**
+ * Unlock
+ */
+ void unlock()
+ {
+ unlock(log.isTraceEnabled());
+ }
+
+ /**
+ * Attempt to get the lock but don't wait
+ *
+ * @param trace whether trace is enabled
+ * @return true when obtained the lock
+ */
+ private boolean attemptLock(boolean trace)
+ {
+ Thread thread = Thread.currentThread();
+ if (trace)
+ log.trace(this + " attemptLock " + thread);
+
+ boolean interrupted = Thread.interrupted();
+
+ boolean result = false;
+ try
+ {
+ result = lock.tryLock(0, TimeUnit.MICROSECONDS);
+ }
+ catch (InterruptedException ignored)
+ {
+ }
+ finally
+ {
+ if (interrupted)
+ thread.interrupt();
+ }
+ if (trace)
+ {
+ if (result)
+ log.trace(this + " locked " + thread + " holding=" + lock.getHoldCount());
+ else
+ log.trace(this + " did NOT get the lock " + thread);
+ }
+
+ // We got the lock so we own it
+ if (result && lock.getHoldCount() == 1)
+ ClassLoaderManager.registerLoaderThread(this, thread);
+
+ return result;
+ }
+
+ /**
+ * Acquire the lock on the classloader fairly<p>
+ *
+ * This must be invoked with the monitor held
+ *
+ * @param trace whether trace is enabled
+ */
+ private void acquireLockFairly(boolean trace)
+ {
+ Thread thread = Thread.currentThread();
+ if (trace)
+ log.trace(this + " aquireLockFairly " + thread);
+
+ boolean interrupted = Thread.interrupted();
+
+ int waits = 0;
+
+ try
+ {
+ while (true)
+ {
+ try
+ {
+ if (lock.tryLock(0, TimeUnit.MICROSECONDS) == false)
+ {
+ // Two minutes should be long enough?
+ if (waits++ == 12)
+ throw new IllegalStateException("Waiting too long to get the classloader lock: " + this);
+ // Wait 10 seconds
+ if (trace)
+ log.trace(this + " waiting for lock " + thread);
+ this.wait(10000);
+ }
+ else
+ {
+ if (trace)
+ log.trace(this + " aquiredLock " + thread + " holding=" + lock.getHoldCount());
+ break;
+ }
+ }
+ catch (InterruptedException ignored)
+ {
+ }
+ }
+ }
+ finally
+ {
+ if (interrupted)
+ thread.interrupt();
+ }
+
+ if (lock.getHoldCount() == 1)
+ ClassLoaderManager.registerLoaderThread(this, thread);
+ }
+
+ /**
+ * Unlock
+ *
+ * @param trace whether trace is enabled
+ */
+ private void unlock(boolean trace)
+ {
+ Thread thread = Thread.currentThread();
+ if (trace)
+ log.trace(this + " unlock " + thread + " holding=" + lock.getHoldCount());
+
+ synchronized (this)
+ {
+ lock.unlock();
+
+ if (lock.getHoldCount() == 0)
+ {
+ ClassLoaderManager.unregisterLoaderThread(this, thread);
+ notifyAll();
+ }
+ }
+ }
+
+ /**
+ * Get the classloader for a class
+ *
+ * @param clazz the class
+ * @return the classloader or null if it doesn't have one
+ */
+ private static final ClassLoader getClassLoader(final Class<?> clazz)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ return clazz.getClassLoader();
+
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return clazz.getClassLoader();
+ }
+ });
+ }
+}
Deleted: projects/jboss-cl/tags/2.0.0.CR5/classloading/pom.xml
===================================================================
--- projects/jboss-cl/branches/Branch_2_0/classloading/pom.xml 2008-10-24 08:59:07 UTC (rev 80027)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloading/pom.xml 2008-11-04 12:22:47 UTC (rev 80482)
@@ -1,126 +0,0 @@
-<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/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-cl</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-classloading</artifactId>
- <packaging>jar</packaging>
- <name>JBoss ClassLoading</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss ClassLoading</description>
-
- <!-- Do not add version information here, use ../pom.xml instead -->
- <dependencies>
-
- <!-- Global dependencies -->
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloader</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.microcontainer</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>
- <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>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- <optional>true</optional>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- </exclusion>
- <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.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <optional>true</optional>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-logging-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-</project>
\ No newline at end of file
Copied: projects/jboss-cl/tags/2.0.0.CR5/classloading/pom.xml (from rev 80481, projects/jboss-cl/branches/Branch_2_0/classloading/pom.xml)
===================================================================
--- projects/jboss-cl/tags/2.0.0.CR5/classloading/pom.xml (rev 0)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloading/pom.xml 2008-11-04 12:22:47 UTC (rev 80482)
@@ -0,0 +1,126 @@
+<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/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-cl</artifactId>
+ <version>2.0.0.CR5</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-classloading</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss ClassLoading</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss ClassLoading</description>
+
+ <!-- Do not add version information here, use ../pom.xml instead -->
+ <dependencies>
+
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloader</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</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>
+ <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>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ </exclusion>
+ <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.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-logging-spi</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/pom.xml
===================================================================
--- projects/jboss-cl/branches/Branch_2_0/classloading-vfs/pom.xml 2008-10-24 08:59:07 UTC (rev 80027)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/pom.xml 2008-11-04 12:22:47 UTC (rev 80482)
@@ -1,128 +0,0 @@
-<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/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-cl</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../build</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-classloading-vfs</artifactId>
- <packaging>jar</packaging>
- <name>JBoss ClassLoading VFS</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>JBoss ClassLoading VFS</description>
-
- <!-- Do not add version information here, use ../pom.xml instead -->
- <dependencies>
-
- <!-- Global dependencies -->
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloading</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.microcontainer</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>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- <optional>true</optional>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- </exclusion>
- <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.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <optional>true</optional>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- </exclusion>
- <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</groupId>
- <artifactId>jboss-vfs</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>
-
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-</project>
\ No newline at end of file
Copied: projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/pom.xml (from rev 80481, projects/jboss-cl/branches/Branch_2_0/classloading-vfs/pom.xml)
===================================================================
--- projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/pom.xml (rev 0)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/pom.xml 2008-11-04 12:22:47 UTC (rev 80482)
@@ -0,0 +1,128 @@
+<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/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-cl</artifactId>
+ <version>2.0.0.CR5</version>
+ <relativePath>../build</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-classloading-vfs</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss ClassLoading VFS</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss ClassLoading VFS</description>
+
+ <!-- Do not add version information here, use ../pom.xml instead -->
+ <dependencies>
+
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</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>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ </exclusion>
+ <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.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ </exclusion>
+ <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</groupId>
+ <artifactId>jboss-vfs</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>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java
===================================================================
--- projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java 2008-10-24 08:59:07 UTC (rev 80027)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java 2008-11-04 12:22:47 UTC (rev 80482)
@@ -1,63 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.classloading.plugins.vfs;
-
-import java.net.URL;
-
-import org.jboss.classloading.plugins.visitor.AbstractResourceContext;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * VFS resource context.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class VFSResourceContext extends AbstractResourceContext
-{
- private VirtualFile file;
-
- public VFSResourceContext(VirtualFile file, String resourceName, ClassLoader classLoader)
- {
- super(resourceName, classLoader);
-
- if (file == null)
- throw new IllegalArgumentException("Null file");
- this.file = file;
- }
-
- public URL getUrl()
- {
- try
- {
- return file.toURL();
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public InputStream getInputStream() throws IOException
- {
- return file.openStream();
- }
-}
Copied: projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java (from rev 80479, projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java)
===================================================================
--- projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java (rev 0)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java 2008-11-04 12:22:47 UTC (rev 80482)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.classloading.plugins.vfs;
+
+import java.net.URL;
+import java.io.InputStream;
+import java.io.IOException;
+
+import org.jboss.classloading.plugins.visitor.AbstractResourceContext;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * VFS resource context.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VFSResourceContext extends AbstractResourceContext
+{
+ private VirtualFile file;
+
+ public VFSResourceContext(VirtualFile file, String resourceName, ClassLoader classLoader)
+ {
+ super(resourceName, classLoader);
+
+ if (file == null)
+ throw new IllegalArgumentException("Null file");
+ this.file = file;
+ }
+
+ public URL getUrl()
+ {
+ try
+ {
+ return file.toURL();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ return file.openStream();
+ }
+}
Deleted: projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java
===================================================================
--- projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java 2008-10-24 08:59:07 UTC (rev 80027)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java 2008-11-04 12:22:47 UTC (rev 80482)
@@ -1,232 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, 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.classloading.spi.vfs.dependency;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.jboss.classloader.spi.filter.ClassFilter;
-import org.jboss.classloading.plugins.vfs.PackageVisitor;
-import org.jboss.classloading.plugins.vfs.VFSResourceVisitor;
-import org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule;
-import org.jboss.classloading.spi.metadata.Capability;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaDataFactory;
-import org.jboss.classloading.spi.metadata.ExportAll;
-import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
-import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
-import org.jboss.classloading.spi.visitor.ResourceFilter;
-import org.jboss.classloading.spi.visitor.ResourceVisitor;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * VFSClassLoaderPolicyModule.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class VFSClassLoaderPolicyModule extends ClassLoaderPolicyModule implements KernelControllerContextAware
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 1L;
-
- /** The roots */
- private List<String> roots;
-
- /** Our cached vfs roots */
- private VirtualFile[] vfsRoots;
-
- /**
- * Create a new VFSClassLoaderPolicyModule.
- *
- * @param classLoadingMetaData the classloading metadata
- * @param contextName the context name
- */
- public VFSClassLoaderPolicyModule(VFSClassLoaderFactory classLoadingMetaData, String contextName)
- {
- super(classLoadingMetaData, contextName);
- }
-
- /**
- * Get the roots.
- *
- * @return the roots.
- */
- public List<String> getRoots()
- {
- return roots;
- }
-
- /**
- * Set the roots.
- *
- * @param roots the roots.
- */
- public void setRoots(List<String> roots)
- {
- this.roots = roots;
- }
-
- @Override
- protected List<Capability> determineCapabilities()
- {
- // While we are here, check the roots
- VirtualFile[] roots = determineVFSRoots();
-
- List<Capability> capabilities = super.determineCapabilities();
- if (capabilities != null)
- return capabilities;
-
- // We need to work it out
- ClassLoadingMetaDataFactory factory = ClassLoadingMetaDataFactory.getInstance();
- capabilities = new CopyOnWriteArrayList<Capability>();
-
- // We have a module capability
- Object version = getVersion();
- Capability capability = factory.createModule(getName(), version);
- capabilities.add(capability);
-
- // Do we determine package capabilities
- ClassFilter included = getIncluded();
- ClassFilter excluded = getExcluded();
- ClassFilter excludedExport = getExcludedExport();
- ExportAll exportAll = getExportAll();
- if (exportAll != null)
- {
- Set<String> exportedPackages = PackageVisitor.determineAllPackages(roots, null, exportAll, included, excluded, excludedExport);
- for (String packageName : exportedPackages)
- {
- capability = factory.createPackage(packageName, version);
- capabilities.add(capability);
- }
- }
-
- return capabilities;
- }
-
- public void setKernelControllerContext(KernelControllerContext context) throws Exception
- {
- setControllerContext(context);
- }
-
- public void unsetKernelControllerContext(KernelControllerContext context) throws Exception
- {
- setControllerContext(null);
- }
-
- @Override
- protected VFSClassLoaderFactory getClassLoadingMetaData()
- {
- return (VFSClassLoaderFactory) super.getClassLoadingMetaData();
- }
-
- /**
- * Get the virtual file roots
- *
- * @return the roots
- */
- protected VirtualFile[] determineVFSRoots()
- {
- if (vfsRoots != null)
- return vfsRoots;
-
- if (roots == null)
- {
- vfsRoots = new VirtualFile[0];
- }
- else
- {
- VirtualFile[] vfsRoots = new VirtualFile[roots.size()];
- for (int i = 0; i < roots.size(); ++i)
- {
- String root = roots.get(i);
- try
- {
- URI uri = new URI(root);
- vfsRoots[i] = VFS.getRoot(uri);
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new RuntimeException("Error creating VFS file for " + root, e);
- }
- }
- this.vfsRoots = vfsRoots;
- }
- return vfsRoots;
- }
-
- @Override
- public VFSClassLoaderPolicy getPolicy()
- {
- return (VFSClassLoaderPolicy) super.getPolicy();
- }
-
- @Override
- protected VFSClassLoaderPolicy determinePolicy()
- {
- VirtualFile[] roots = determineVFSRoots();
- VFSClassLoaderPolicy policy = VFSClassLoaderPolicy.createVFSClassLoaderPolicy(getContextName(), roots);
- String[] packageNames = getPackageNames();
- policy.setExportedPackages(packageNames);
- policy.setIncluded(getIncluded());
- policy.setExcluded(getExcluded());
- policy.setExcludedExport(getExcludedExport());
- policy.setExportAll(getExportAll());
- policy.setImportAll(isImportAll());
- policy.setCacheable(isCacheable());
- policy.setBlackListable(isBlackListable());
- policy.setDelegates(getDelegates());
- return policy;
- }
-
- @Override
- public void reset()
- {
- super.reset();
- vfsRoots = null;
- }
-
- @Override
- public void visit(ResourceVisitor visitor, ResourceFilter filter, ResourceFilter recurseFilter, URL... urls)
- {
- ClassLoader classLoader = getClassLoader();
- if (classLoader == null)
- throw new IllegalStateException("ClassLoader has not been constructed for " + getContextName());
-
- VirtualFile[] roots = determineVFSRoots();
- if (roots != null && roots.length > 0)
- {
- ClassFilter included = getIncluded();
- ClassFilter excluded = getExcluded();
- VFSResourceVisitor.visit(roots, null, included, excluded, classLoader, visitor, filter, recurseFilter, urls);
- }
- }
-}
Copied: projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java (from rev 80479, projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java)
===================================================================
--- projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java (rev 0)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java 2008-11-04 12:22:47 UTC (rev 80482)
@@ -0,0 +1,244 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.classloading.spi.vfs.dependency;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.classloader.spi.filter.ClassFilter;
+import org.jboss.classloading.plugins.vfs.PackageVisitor;
+import org.jboss.classloading.plugins.vfs.VFSResourceVisitor;
+import org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule;
+import org.jboss.classloading.spi.metadata.Capability;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaDataFactory;
+import org.jboss.classloading.spi.metadata.ExportAll;
+import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
+import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
+import org.jboss.classloading.spi.visitor.ResourceFilter;
+import org.jboss.classloading.spi.visitor.ResourceVisitor;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * VFSClassLoaderPolicyModule.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class VFSClassLoaderPolicyModule extends ClassLoaderPolicyModule implements KernelControllerContextAware
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ /** The roots */
+ private List<String> roots;
+
+ /** Our cached vfs roots */
+ private VirtualFile[] vfsRoots;
+
+ /**
+ * Create a new VFSClassLoaderPolicyModule.
+ *
+ * @param classLoadingMetaData the classloading metadata
+ * @param contextName the context name
+ */
+ public VFSClassLoaderPolicyModule(VFSClassLoaderFactory classLoadingMetaData, String contextName)
+ {
+ super(classLoadingMetaData, contextName);
+ }
+
+ /**
+ * Get the roots.
+ *
+ * @return the roots.
+ */
+ public List<String> getRoots()
+ {
+ return roots;
+ }
+
+ /**
+ * Set the roots.
+ *
+ * @param roots the roots.
+ */
+ public void setRoots(List<String> roots)
+ {
+ this.roots = roots;
+ }
+
+ @Override
+ protected List<Capability> determineCapabilities()
+ {
+ // While we are here, check the roots
+ VirtualFile[] roots = determineVFSRoots();
+
+ List<Capability> capabilities = super.determineCapabilities();
+ if (capabilities != null)
+ return capabilities;
+
+ // We need to work it out
+ ClassLoadingMetaDataFactory factory = ClassLoadingMetaDataFactory.getInstance();
+ capabilities = new CopyOnWriteArrayList<Capability>();
+
+ // We have a module capability
+ Object version = getVersion();
+ Capability capability = factory.createModule(getName(), version);
+ capabilities.add(capability);
+
+ // Do we determine package capabilities
+ ClassFilter included = getIncluded();
+ ClassFilter excluded = getExcluded();
+ ClassFilter excludedExport = getExcludedExport();
+ ExportAll exportAll = getExportAll();
+ if (exportAll != null)
+ {
+ Set<String> exportedPackages = PackageVisitor.determineAllPackages(roots, null, exportAll, included, excluded, excludedExport);
+ for (String packageName : exportedPackages)
+ {
+ capability = factory.createPackage(packageName, version);
+ capabilities.add(capability);
+ }
+ }
+
+ return capabilities;
+ }
+
+ public void setKernelControllerContext(KernelControllerContext context) throws Exception
+ {
+ setControllerContext(context);
+ }
+
+ public void unsetKernelControllerContext(KernelControllerContext context) throws Exception
+ {
+ setControllerContext(null);
+ }
+
+ @Override
+ protected VFSClassLoaderFactory getClassLoadingMetaData()
+ {
+ return (VFSClassLoaderFactory) super.getClassLoadingMetaData();
+ }
+
+ /**
+ * Get the virtual file roots
+ *
+ * @return the roots
+ */
+ protected VirtualFile[] determineVFSRoots()
+ {
+ if (vfsRoots != null)
+ return vfsRoots;
+
+ if (roots == null)
+ {
+ vfsRoots = new VirtualFile[0];
+ }
+ else
+ {
+ VirtualFile[] vfsRoots = new VirtualFile[roots.size()];
+ for (int i = 0; i < roots.size(); ++i)
+ {
+ String root = roots.get(i);
+ try
+ {
+ URI uri = new URI(root);
+ vfsRoots[i] = getVirtualFile(uri);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Error creating VFS file for " + root, e);
+ }
+ }
+ this.vfsRoots = vfsRoots;
+ }
+ return vfsRoots;
+ }
+
+ /**
+ * Get virtual file for uri.
+ *
+ * @param uri the uri
+ * @return virtual file for uri
+ * @throws Exception for any error
+ */
+ protected VirtualFile getVirtualFile(URI uri) throws Exception
+ {
+ return VFS.getCachedFile(uri);
+ }
+
+ @Override
+ public VFSClassLoaderPolicy getPolicy()
+ {
+ return (VFSClassLoaderPolicy) super.getPolicy();
+ }
+
+ @Override
+ protected VFSClassLoaderPolicy determinePolicy()
+ {
+ VirtualFile[] roots = determineVFSRoots();
+ VFSClassLoaderPolicy policy = VFSClassLoaderPolicy.createVFSClassLoaderPolicy(getContextName(), roots);
+ String[] packageNames = getPackageNames();
+ policy.setExportedPackages(packageNames);
+ policy.setIncluded(getIncluded());
+ policy.setExcluded(getExcluded());
+ policy.setExcludedExport(getExcludedExport());
+ policy.setExportAll(getExportAll());
+ policy.setImportAll(isImportAll());
+ policy.setCacheable(isCacheable());
+ policy.setBlackListable(isBlackListable());
+ policy.setDelegates(getDelegates());
+ return policy;
+ }
+
+ @Override
+ public void reset()
+ {
+ super.reset();
+ vfsRoots = null;
+ }
+
+ @Override
+ public void visit(ResourceVisitor visitor, ResourceFilter filter, ResourceFilter recurseFilter, URL... urls)
+ {
+ ClassLoader classLoader = getClassLoader();
+ if (classLoader == null)
+ throw new IllegalStateException("ClassLoader has not been constructed for " + getContextName());
+
+ VirtualFile[] roots = determineVFSRoots();
+ if (roots != null && roots.length > 0)
+ {
+ ClassFilter included = getIncluded();
+ ClassFilter excluded = getExcluded();
+ VFSResourceVisitor.visit(roots, null, included, excluded, classLoader, visitor, filter, recurseFilter, urls);
+ }
+ }
+}
Deleted: projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/metadata/VFSClassLoaderFactory.java
===================================================================
--- projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/metadata/VFSClassLoaderFactory.java 2008-10-24 08:59:07 UTC (rev 80027)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/metadata/VFSClassLoaderFactory.java 2008-11-04 12:22:47 UTC (rev 80482)
@@ -1,202 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, 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.classloading.spi.vfs.metadata;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.classloading.spi.version.Version;
-import org.jboss.classloading.spi.vfs.dependency.VFSClassLoaderPolicyModule;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * VFSClassLoaderFactory.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class VFSClassLoaderFactory extends ClassLoadingMetaData implements BeanMetaDataFactory
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = -4446195023830263521L;
-
- /** The default name for the classloading system */
- public static final String DEFAULT_CLASSLOADER_SYSTEM_NAME = "ClassLoaderSystem";
-
- /** The name of the classloader system */
- private String classLoaderSystemName = DEFAULT_CLASSLOADER_SYSTEM_NAME;
-
- /** The context name */
- private String contextName = null;
-
- /** The roots */
- private List<String> roots = new CopyOnWriteArrayList<String>();
-
- /**
- * Create a new VFSClassLoaderFactory.
- */
- public VFSClassLoaderFactory()
- {
- }
-
- /**
- * Create a new VFSClassLoaderFactory.
- *
- * @param name the name
- */
- public VFSClassLoaderFactory(String name)
- {
- this(name, Version.DEFAULT_VERSION);
- }
-
- /**
- * Create a new VFSClassLoaderFactory.
- *
- * @param name the name
- * @param version the version
- */
- public VFSClassLoaderFactory(String name, String version)
- {
- this(name, Version.parseVersion(version));
- }
-
- /**
- * Create a new VFSClassLoaderFactory.
- *
- * @param name the name
- * @param version the version
- */
- public VFSClassLoaderFactory(String name, Version version)
- {
- setName(name);
- setVersion(version);
- }
-
- /**
- * Get the classLoaderSystemName.
- *
- * @return the classLoaderSystemName.
- */
- public String getClassLoaderSystemName()
- {
- return classLoaderSystemName;
- }
-
- /**
- * Set the classLoaderSystemName.
- *
- * @param classLoaderSystemName the classLoaderSystemName.
- */
- @ManagementProperty(name="system")
- @XmlAttribute(name="system")
- public void setClassLoaderSystemName(String classLoaderSystemName)
- {
- if (classLoaderSystemName == null)
- classLoaderSystemName = DEFAULT_CLASSLOADER_SYSTEM_NAME;
- this.classLoaderSystemName = classLoaderSystemName;
- }
-
- /**
- * Get the contextName.
- *
- * @return the contextName.
- */
- public String getContextName()
- {
- return contextName;
- }
-
- /**
- * Set the contextName.
- *
- * @param contextName the contextName.
- */
- @ManagementProperty(name="context")
- @XmlAttribute(name="context")
- public void setContextName(String contextName)
- {
- this.contextName = contextName;
- }
-
- /**
- * Get the roots.
- *
- * @return the roots.
- */
- public List<String> getRoots()
- {
- return roots;
- }
-
- /**
- * Set the roots.
- *
- * @param roots the roots.
- */
- @ManagementProperty(name="roots")
- @XmlElement(name="root")
- public void setRoots(List<String> roots)
- {
- if (roots == null)
- roots = new CopyOnWriteArrayList<String>();
- this.roots = roots;
- }
-
- @XmlTransient
- public List<BeanMetaData> getBeans()
- {
- // Determine some properties
- String contextName = getContextName();
- if (contextName == null)
- contextName = getName() + ":" + getVersion();
- String moduleName = contextName + "$MODULE";
-
- // Create the module
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(moduleName, VFSClassLoaderPolicyModule.class.getName());
- builder.addConstructorParameter(VFSClassLoaderFactory.class.getName(), this);
- builder.addConstructorParameter(String.class.getName(), moduleName);
- builder.addPropertyMetaData("roots", roots);
- builder.setNoClassLoader();
- builder.addUninstall("removeClassLoader");
- BeanMetaData module = builder.getBeanMetaData();
-
- // Create the classloader
- builder = BeanMetaDataBuilder.createBuilder(contextName, ClassLoader.class.getName());
- builder.setNoClassLoader();
- builder.setFactory(moduleName);
- builder.setFactoryMethod("registerClassLoaderPolicy");
- builder.addConstructorParameter(ClassLoaderSystem.class.getName(), builder.createInject(classLoaderSystemName));
- BeanMetaData classLoader = builder.getBeanMetaData();
-
- return Arrays.asList(classLoader, module);
- }
-}
Copied: projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/metadata/VFSClassLoaderFactory.java (from rev 80479, projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/metadata/VFSClassLoaderFactory.java)
===================================================================
--- projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/metadata/VFSClassLoaderFactory.java (rev 0)
+++ projects/jboss-cl/tags/2.0.0.CR5/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/metadata/VFSClassLoaderFactory.java 2008-11-04 12:22:47 UTC (rev 80482)
@@ -0,0 +1,212 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.classloading.spi.vfs.metadata;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.version.Version;
+import org.jboss.classloading.spi.vfs.dependency.VFSClassLoaderPolicyModule;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * VFSClassLoaderFactory.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class VFSClassLoaderFactory extends ClassLoadingMetaData implements BeanMetaDataFactory
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -4446195023830263521L;
+
+ /** The default name for the classloading system */
+ public static final String DEFAULT_CLASSLOADER_SYSTEM_NAME = "ClassLoaderSystem";
+
+ /** The name of the classloader system */
+ private String classLoaderSystemName = DEFAULT_CLASSLOADER_SYSTEM_NAME;
+
+ /** The context name */
+ private String contextName = null;
+
+ /** The roots */
+ private List<String> roots = new CopyOnWriteArrayList<String>();
+
+ /**
+ * Create a new VFSClassLoaderFactory.
+ */
+ public VFSClassLoaderFactory()
+ {
+ }
+
+ /**
+ * Create a new VFSClassLoaderFactory.
+ *
+ * @param name the name
+ */
+ public VFSClassLoaderFactory(String name)
+ {
+ this(name, Version.DEFAULT_VERSION);
+ }
+
+ /**
+ * Create a new VFSClassLoaderFactory.
+ *
+ * @param name the name
+ * @param version the version
+ */
+ public VFSClassLoaderFactory(String name, String version)
+ {
+ this(name, Version.parseVersion(version));
+ }
+
+ /**
+ * Create a new VFSClassLoaderFactory.
+ *
+ * @param name the name
+ * @param version the version
+ */
+ public VFSClassLoaderFactory(String name, Version version)
+ {
+ setName(name);
+ setVersion(version);
+ }
+
+ /**
+ * Get the classLoaderSystemName.
+ *
+ * @return the classLoaderSystemName.
+ */
+ public String getClassLoaderSystemName()
+ {
+ return classLoaderSystemName;
+ }
+
+ /**
+ * Set the classLoaderSystemName.
+ *
+ * @param classLoaderSystemName the classLoaderSystemName.
+ */
+ @ManagementProperty(name="system")
+ @XmlAttribute(name="system")
+ public void setClassLoaderSystemName(String classLoaderSystemName)
+ {
+ if (classLoaderSystemName == null)
+ classLoaderSystemName = DEFAULT_CLASSLOADER_SYSTEM_NAME;
+ this.classLoaderSystemName = classLoaderSystemName;
+ }
+
+ /**
+ * Get the contextName.
+ *
+ * @return the contextName.
+ */
+ public String getContextName()
+ {
+ return contextName;
+ }
+
+ /**
+ * Set the contextName.
+ *
+ * @param contextName the contextName.
+ */
+ @ManagementProperty(name="context")
+ @XmlAttribute(name="context")
+ public void setContextName(String contextName)
+ {
+ this.contextName = contextName;
+ }
+
+ /**
+ * Get the roots.
+ *
+ * @return the roots.
+ */
+ public List<String> getRoots()
+ {
+ return roots;
+ }
+
+ /**
+ * Set the roots.
+ *
+ * @param roots the roots.
+ */
+ @ManagementProperty(name="roots")
+ @XmlElement(name="root")
+ public void setRoots(List<String> roots)
+ {
+ if (roots == null)
+ roots = new CopyOnWriteArrayList<String>();
+ this.roots = roots;
+ }
+
+ /**
+ * Get module class.
+ *
+ * @return the module class.
+ */
+ protected Class<? extends VFSClassLoaderPolicyModule> getModuleClass()
+ {
+ return VFSClassLoaderPolicyModule.class;
+ }
+
+ @XmlTransient
+ public List<BeanMetaData> getBeans()
+ {
+ // Determine some properties
+ String contextName = getContextName();
+ if (contextName == null)
+ contextName = getName() + ":" + getVersion();
+ String moduleName = contextName + "$MODULE";
+
+ // Create the module
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(moduleName, getModuleClass().getName());
+ builder.addConstructorParameter(VFSClassLoaderFactory.class.getName(), this);
+ builder.addConstructorParameter(String.class.getName(), moduleName);
+ builder.addPropertyMetaData("roots", roots);
+ builder.setNoClassLoader();
+ builder.addUninstall("removeClassLoader");
+ BeanMetaData module = builder.getBeanMetaData();
+
+ // Create the classloader
+ builder = BeanMetaDataBuilder.createBuilder(contextName, ClassLoader.class.getName());
+ builder.setNoClassLoader();
+ builder.setFactory(moduleName);
+ builder.setFactoryMethod("registerClassLoaderPolicy");
+ builder.addConstructorParameter(ClassLoaderSystem.class.getName(), builder.createInject(classLoaderSystemName));
+ BeanMetaData classLoader = builder.getBeanMetaData();
+
+ return Arrays.asList(classLoader, module);
+ }
+}
Deleted: projects/jboss-cl/tags/2.0.0.CR5/pom.xml
===================================================================
--- projects/jboss-cl/branches/Branch_2_0/pom.xml 2008-10-24 08:59:07 UTC (rev 80027)
+++ projects/jboss-cl/tags/2.0.0.CR5/pom.xml 2008-11-04 12:22:47 UTC (rev 80482)
@@ -1,314 +0,0 @@
-<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>4</version>
- </parent>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-cl</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>JBoss ClassLoader Parent POM</name>
- <url>http://www.jboss.com/products/jbossmc</url>
- <description>
- JBoss ClassLoader
- </description>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-cl/branches/Branch_2_0/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-cl/branches/Branch_2_0/</developerConnection>
- <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/jboss-cl/branches/Branch_2_0</url>
- </scm>
-
- <modules>
- <module>classloader</module>
- <module>classloading</module>
- <module>classloading-vfs</module>
- <module>build</module>
- </modules>
-
- <properties>
- <version.jboss.man>2.0.0.CR1</version.jboss.man>
- <version.jboss.microcontainer>2.0.0.CR2</version.jboss.microcontainer>
- <version.jboss.common.core>2.2.8.GA</version.jboss.common.core>
- <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
- <version.jboss.classloading.spi>5.0.0.CR2</version.jboss.classloading.spi>
- <version.jboss.vfs>2.0.0.CR1</version.jboss.vfs>
- <version.jbossxb>2.0.0.CR14</version.jbossxb>
- <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
- <version.junit>4.4</version.junit>
- </properties>
-
- <build>
- <outputDirectory>${microcontainer.outputDirectory}</outputDirectory>
- <testOutputDirectory>${microcontainer.testOutputDirectory}</testOutputDirectory>
- <finalName>${artifactId}</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- <showDeprecation>true</showDeprecation>
- <showWarnings>true</showWarnings>
- <optimize>true</optimize>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <version>2.0-beta-7</version>
- <configuration>
- <generateReleasePoms>false</generateReleasePoms>
- <tagBase>https://svn.jboss.org/repos/jbossas/projects/jboss-cl/tags</tagBase>
- <autoVersionSubmodules>true</autoVersionSubmodules>
- </configuration>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-idea-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.1</version>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <includes>
- <include>org/jboss/test/**/*TestCase.java</include>
- </includes>
- </configuration>
- </plugin>
- <plugin>
- <!-- Configure javadoc plugin with APIviz -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <doclet>net.gleamynode.apiviz.APIviz</doclet>
- <docletArtifact>
- <groupId>net.gleamynode.apiviz</groupId>
- <artifactId>apiviz</artifactId>
- <version>1.1.0</version>
- </docletArtifact>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- <!-- APIviz repository -->
- <repository>
- <id>apiviz.release</id>
- <name>APIviz releases</name>
- <url>http://apiviz.googlecode.com/svn/site/repo/mvn/release</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <reportSets>
- <reportSet>
- <reports>
- <report>dependencies</report>
- <report>issue-tracking</report>
- <report>license</report>
- <report>scm</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <version>1.0.0</version>
- </plugin>
- </plugins>
- </reporting>
-
- <dependencyManagement>
- <!-- The parent pom manages the inter-dependencies of the modules. -->
- <dependencies>
-
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloader</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloading</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloading-vfs</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <version>${version.jboss.man}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- <version>${version.jboss.microcontainer}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- <version>${version.jboss.microcontainer}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- <version>${version.jboss.common.core}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- <version>${version.jboss.logging.spi}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.integration</groupId>
- <artifactId>jboss-classloading-spi</artifactId>
- <version>${version.jboss.classloading.spi}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- <version>${version.jbossxb}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <version>${version.jboss.vfs}</version>
- </dependency>
-
- <!-- test dependencies -->
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <version>${version.org.jboss.test}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${version.junit}</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <properties>
- <microcontainer.outputDirectory>target/classes</microcontainer.outputDirectory>
- <microcontainer.testOutputDirectory>target/tests-classes</microcontainer.testOutputDirectory>
- </properties>
- </profile>
- <profile>
- <id>eclipse</id>
- <build>
- <defaultGoal>process-test-resources</defaultGoal>
- <plugins>
- <plugin>
- <artifactId>maven-eclipse-plugin</artifactId>
- <executions>
- <execution>
- <id>eclipse</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>eclipse</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <downloadSources>true</downloadSources>
- <buildOutputDirectory>${microcontainer.outputDirectory}</buildOutputDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <properties>
- <microcontainer.outputDirectory>eclipse-target/classes</microcontainer.outputDirectory>
- <microcontainer.testOutputDirectory>eclipse-target/tests-classes</microcontainer.testOutputDirectory>
- </properties>
- </profile>
- </profiles>
-
-</project>
\ No newline at end of file
Copied: projects/jboss-cl/tags/2.0.0.CR5/pom.xml (from rev 80481, projects/jboss-cl/branches/Branch_2_0/pom.xml)
===================================================================
--- projects/jboss-cl/tags/2.0.0.CR5/pom.xml (rev 0)
+++ projects/jboss-cl/tags/2.0.0.CR5/pom.xml 2008-11-04 12:22:47 UTC (rev 80482)
@@ -0,0 +1,314 @@
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>4</version>
+ </parent>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-cl</artifactId>
+ <version>2.0.0.CR5</version>
+ <packaging>pom</packaging>
+ <name>JBoss ClassLoader Parent POM</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>
+ JBoss ClassLoader
+ </description>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-cl/tags/2.0.0.CR5</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-cl/tags/2.0.0.CR5</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/jboss-cl/tags/2.0.0.CR5</url>
+ </scm>
+
+ <modules>
+ <module>classloader</module>
+ <module>classloading</module>
+ <module>classloading-vfs</module>
+ <module>build</module>
+ </modules>
+
+ <properties>
+ <version.jboss.man>2.0.0.CR2</version.jboss.man>
+ <version.jboss.microcontainer>2.0.0.CR4</version.jboss.microcontainer>
+ <version.jboss.common.core>2.2.9.GA</version.jboss.common.core>
+ <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
+ <version.jboss.classloading.spi>5.0.0.CR2</version.jboss.classloading.spi>
+ <version.jboss.vfs>2.0.0.CR2</version.jboss.vfs>
+ <version.jbossxb>2.0.0.GA</version.jbossxb>
+ <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
+ <version.junit>4.4</version.junit>
+ </properties>
+
+ <build>
+ <outputDirectory>${microcontainer.outputDirectory}</outputDirectory>
+ <testOutputDirectory>${microcontainer.testOutputDirectory}</testOutputDirectory>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <optimize>true</optimize>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-7</version>
+ <configuration>
+ <generateReleasePoms>false</generateReleasePoms>
+ <tagBase>https://svn.jboss.org/repos/jbossas/projects/jboss-cl/tags</tagBase>
+ <autoVersionSubmodules>true</autoVersionSubmodules>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-idea-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.1</version>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <includes>
+ <include>org/jboss/test/**/*TestCase.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!-- Configure javadoc plugin with APIviz -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <doclet>net.gleamynode.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>net.gleamynode.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.1.0</version>
+ </docletArtifact>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ <!-- APIviz repository -->
+ <repository>
+ <id>apiviz.release</id>
+ <name>APIviz releases</name>
+ <url>http://apiviz.googlecode.com/svn/site/repo/mvn/release</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>dependencies</report>
+ <report>issue-tracking</report>
+ <report>license</report>
+ <report>scm</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>1.0.0</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <dependencyManagement>
+ <!-- The parent pom manages the inter-dependencies of the modules. -->
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloader</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading-vfs</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <version>${version.jboss.man}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ <version>${version.jboss.microcontainer}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>${version.jboss.microcontainer}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>${version.jboss.common.core}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>${version.jboss.logging.spi}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.integration</groupId>
+ <artifactId>jboss-classloading-spi</artifactId>
+ <version>${version.jboss.classloading.spi}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ <version>${version.jbossxb}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>${version.jboss.vfs}</version>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>${version.org.jboss.test}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <microcontainer.outputDirectory>target/classes</microcontainer.outputDirectory>
+ <microcontainer.testOutputDirectory>target/tests-classes</microcontainer.testOutputDirectory>
+ </properties>
+ </profile>
+ <profile>
+ <id>eclipse</id>
+ <build>
+ <defaultGoal>process-test-resources</defaultGoal>
+ <plugins>
+ <plugin>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>eclipse</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>eclipse</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ <buildOutputDirectory>${microcontainer.outputDirectory}</buildOutputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <microcontainer.outputDirectory>eclipse-target/classes</microcontainer.outputDirectory>
+ <microcontainer.testOutputDirectory>eclipse-target/tests-classes</microcontainer.testOutputDirectory>
+ </properties>
+ </profile>
+ </profiles>
+
+</project>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list