org.mule.module.launcher
Class MuleSharedDomainClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.mule.module.launcher.GoodCitizenClassLoader
                  extended by org.mule.module.launcher.MuleSharedDomainClassLoader
All Implemented Interfaces:
Closeable, ArtifactClassLoader

public class MuleSharedDomainClassLoader
extends GoodCitizenClassLoader
implements ArtifactClassLoader

Load $MULE_HOME/lib/shared/ libraries.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.mule.module.launcher.GoodCitizenClassLoader
GoodCitizenClassLoader.NonCachingURLStreamHandlerFactory
 
Field Summary
static String DOMAIN_LIBRARY_FOLDER
           
protected  Log logger
           
static String OLD_DOMAIN_LIBRARY_FOLDER
           
 
Constructor Summary
MuleSharedDomainClassLoader(String domain, ClassLoader parent)
           
 
Method Summary
 void dispose()
          Gets rid of the class loader resources.
 URL findResource(String name)
           
 String getArtifactName()
           
 ClassLoader getClassLoader()
          ClassLoader is an abstract class.
 String toString()
           
 
Methods inherited from class org.mule.module.launcher.GoodCitizenClassLoader
close
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected transient Log logger

DOMAIN_LIBRARY_FOLDER

public static final String DOMAIN_LIBRARY_FOLDER
See Also:
Constant Field Values

OLD_DOMAIN_LIBRARY_FOLDER

public static final String OLD_DOMAIN_LIBRARY_FOLDER
Constructor Detail

MuleSharedDomainClassLoader

public MuleSharedDomainClassLoader(String domain,
                                   ClassLoader parent)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getArtifactName

public String getArtifactName()
Specified by:
getArtifactName in interface ArtifactClassLoader
Returns:
the artifact unique identifier

getClassLoader

public ClassLoader getClassLoader()
Description copied from interface: ArtifactClassLoader
ClassLoader is an abstract class. Not an interface. There are parts of the code that requires a ClassLoader and others that requires an ArtifactClassLoader. Ideally I would make ArtifactClassLoader implement ClassLoader interface but there's no such interface. So if I have a method that requires a ClassLoader instance and an ArtifactClassLoader I would have to down cast and assume that it can be down casted or send two parameters, one for the ClassLoader and one for the ArtifactClassLoader: public void doSomething(ArtifactClassLoader acl) { doSomething2(acl); //this requires an ArtifactClassLoader doSomething3((ClassLoader)acl); //this requires a ClassLoader } public void doSomething(ArtifactClassLoader acl, ClassLoader cl) { doSomething2(acl); //this requires an ArtifactClassLoader doSomething3(cl); //this requires a ClassLoader } To overcome that problem seems much better to have a method in ArtifactClassLoader that can actually return a ClassLoader instance: public void doSomething(ArtifactClassLoader acl) { doSomething2(acl); //this requires an ArtifactClassLoader doSomething3(acl.getDomainClassLoader()); //this requires a ClassLoader }

Specified by:
getClassLoader in interface ArtifactClassLoader
Returns:
class loader to use for this artifact.

dispose

public void dispose()
Description copied from interface: ArtifactClassLoader
Gets rid of the class loader resources.

Specified by:
dispose in interface ArtifactClassLoader

findResource

public URL findResource(String name)
Specified by:
findResource in interface ArtifactClassLoader
Overrides:
findResource in class URLClassLoader
Parameters:
name - name of the resource to find.
Returns:
the resource URL, null if it doesn't exists.


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.