org.mule.module.launcher
Class MuleApplicationClassLoader

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.FineGrainedControlClassLoader
                      extended by org.mule.module.launcher.artifact.AbstractArtifactClassLoader
                          extended by org.mule.module.launcher.MuleApplicationClassLoader
All Implemented Interfaces:
ApplicationClassLoader, ArtifactClassLoader, DisposableClassLoader, LocalResourceLocator

public class MuleApplicationClassLoader
extends AbstractArtifactClassLoader
implements ApplicationClassLoader


Nested Class Summary
 
Nested classes/interfaces inherited from class org.mule.module.launcher.GoodCitizenClassLoader
GoodCitizenClassLoader.NonCachingURLStreamHandlerFactory
 
Field Summary
protected static URL[] CLASSPATH_EMPTY
           
static String PATH_CLASSES
          Classes and resources directory in Mule application.
static String PATH_LIBRARY
          Library directory in Mule application.
static String PATH_MULE
          Directory for standard mule modules and transports
static String PATH_PER_APP
          Sub-directory for per-application mule modules and transports
 
Fields inherited from class org.mule.module.launcher.artifact.AbstractArtifactClassLoader
logger, shutdownListeners
 
Fields inherited from class org.mule.module.launcher.FineGrainedControlClassLoader
blocked, overrides, systemPackages
 
Constructor Summary
MuleApplicationClassLoader(String appName, ClassLoader parentCl)
           
MuleApplicationClassLoader(String appName, ClassLoader parentCl, Set<String> loaderOverrides)
           
 
Method Summary
protected  Class<?> findClass(String name)
           
protected  String findLibrary(String name)
           
 String getAppName()
           
 String getArtifactName()
           
 ClassLoader getClassLoader()
          ClassLoader is an abstract class.
protected  String[] getLocalResourceLocations()
           
 URL getResource(String name)
           
 Enumeration<URL> getResources(String name)
           
 String toString()
           
 
Methods inherited from class org.mule.module.launcher.artifact.AbstractArtifactClassLoader
addShutdownListener, dispose, findLocalResource
 
Methods inherited from class org.mule.module.launcher.FineGrainedControlClassLoader
findParentClass, isBlocked, isOverridden, loadClass, processOverrides
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findResource, 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, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mule.module.launcher.application.ApplicationClassLoader
findResource
 
Methods inherited from interface org.mule.module.launcher.artifact.ArtifactClassLoader
addShutdownListener
 
Methods inherited from interface org.mule.module.launcher.DisposableClassLoader
dispose
 
Methods inherited from interface org.mule.module.launcher.LocalResourceLocator
findLocalResource
 

Field Detail

PATH_LIBRARY

public static final String PATH_LIBRARY
Library directory in Mule application.

See Also:
Constant Field Values

PATH_CLASSES

public static final String PATH_CLASSES
Classes and resources directory in Mule application.

See Also:
Constant Field Values

PATH_MULE

public static final String PATH_MULE
Directory for standard mule modules and transports

See Also:
Constant Field Values

PATH_PER_APP

public static final String PATH_PER_APP
Sub-directory for per-application mule modules and transports

See Also:
Constant Field Values

CLASSPATH_EMPTY

protected static final URL[] CLASSPATH_EMPTY
Constructor Detail

MuleApplicationClassLoader

public MuleApplicationClassLoader(String appName,
                                  ClassLoader parentCl)

MuleApplicationClassLoader

public MuleApplicationClassLoader(String appName,
                                  ClassLoader parentCl,
                                  Set<String> loaderOverrides)
Method Detail

findClass

protected Class<?> findClass(String name)
                      throws ClassNotFoundException
Overrides:
findClass in class FineGrainedControlClassLoader
Throws:
ClassNotFoundException

getResource

public URL getResource(String name)
Overrides:
getResource in class ClassLoader

getResources

public Enumeration<URL> getResources(String name)
                              throws IOException
Overrides:
getResources in class ClassLoader
Throws:
IOException

getAppName

public String getAppName()
Specified by:
getAppName in interface ApplicationClassLoader

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.

findLibrary

protected String findLibrary(String name)
Overrides:
findLibrary in class ClassLoader

getLocalResourceLocations

protected String[] getLocalResourceLocations()
Specified by:
getLocalResourceLocations in class AbstractArtifactClassLoader


Copyright © 2003–2014 MuleSoft, Inc.. All rights reserved.