org.jboss.classloading.spi.dependency.policy.mock
Class MockClassLoaderPolicyModule

java.lang.Object
  extended by org.jboss.classloading.spi.helpers.NameAndVersionSupport
      extended by org.jboss.classloading.spi.dependency.Module
          extended by org.jboss.classloading.spi.dependency.helpers.ClassLoadingMetaDataModule
              extended by org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule
                  extended by org.jboss.classloading.spi.dependency.policy.mock.MockClassLoaderPolicyModule
All Implemented Interfaces:
Serializable, Cloneable, org.jboss.kernel.spi.dependency.KernelControllerContextAware

public class MockClassLoaderPolicyModule
extends ClassLoaderPolicyModule
implements org.jboss.kernel.spi.dependency.KernelControllerContextAware

VFSClassLoaderPolicyModule.

Version:
$Revision: 1.1 $
Author:
Adrian Brock
See Also:
Serialized Form

Constructor Summary
MockClassLoaderPolicyModule(MockClassLoadingMetaData classLoadingMetaData, String contextName)
          Create a new VFSClassLoaderPolicyModule.
 
Method Summary
protected  List<Capability> determineCapabilities()
          Determine the capabilities
protected  MockClassLoaderPolicy determinePolicy()
          Determine the classloader policy
protected  MockClassLoadingMetaData getClassLoadingMetaData()
          Get the classloading metadata
protected  File getFile(URL url)
          Get file from path's url.
 MockClassLoaderPolicy getPolicy()
          Get the policy
protected  URL getURL(String path)
          Get URL for path param.
protected  boolean includePath(String path, Collection<String> included, ClassFilter includedFilter, Collection<String> excluded, ClassFilter excludedFilter)
          Should we include path in visit.
 void setKernelControllerContext(org.jboss.kernel.spi.dependency.KernelControllerContext context)
           
 void unsetKernelControllerContext(org.jboss.kernel.spi.dependency.KernelControllerContext context)
           
 void visit(ResourceVisitor visitor, ResourceFilter filter, ResourceFilter recurseFilter, URL... urls)
          Visit the resources in this module using the given filter(s)

Typically the filter is used to determine which types of files to visit, e.g.

protected  void visitPath(File file, String path, ResourceVisitor visitor, ResourceFilter filter, ResourceFilter recurseFilter, ClassLoader classLoader, Collection<String> included, ClassFilter includedFilter, Collection<String> excluded, ClassFilter excludedFilter, ResourceContext context)
          Visit path.
 
Methods inherited from class org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule
createLazyDelegateLoader, getClassLoader, getClassLoaderForClass, getDelegateLoader, registerClassLoaderPolicy, registerClassLoaderPolicy, registerClassLoaderPolicy, removeClassLoader, reset
 
Methods inherited from class org.jboss.classloading.spi.dependency.helpers.ClassLoadingMetaDataModule
determineRequirements, getDomainName, getExcluded, getExcludedExport, getExportAll, getIncluded, getParentDomainName, isBlackListable, isCacheable, isImportAll, isJ2seClassLoadingCompliance
 
Methods inherited from class org.jboss.classloading.spi.dependency.Module
addDelegates, addIDependOn, createDependencies, defaultCapabilities, determinePackageNames, equals, getCapabilities, getClassLoaderState, getContextName, getControllerContext, getDelegates, getDeterminedDomainName, getDeterminedParentDomainName, getDeterminedParentPolicy, getDynamicClassRoot, getModuleForClass, getPackageNames, getRequirementDependencyItems, getRequirements, getResource, getResources, isValid, loadClass, registerModuleClassLoader, release, removeDependencies, removeIDependOn, resolveModule, setControllerContext, unregisterModuleClassLoader, visit, visit
 
Methods inherited from class org.jboss.classloading.spi.helpers.NameAndVersionSupport
clone, getName, getTheVersion, getVersion, hashCode, setName, setTheVersion, setVersion, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MockClassLoaderPolicyModule

public MockClassLoaderPolicyModule(MockClassLoadingMetaData classLoadingMetaData,
                                   String contextName)
Create a new VFSClassLoaderPolicyModule.

Parameters:
classLoadingMetaData - the classloading metadata
contextName - the context name
Method Detail

getURL

protected URL getURL(String path)
Get URL for path param.

Parameters:
path - the path
Returns:
path's URL

getFile

protected File getFile(URL url)
Get file from path's url.

Parameters:
url - the path's url
Returns:
path's file

visit

public void visit(ResourceVisitor visitor,
                  ResourceFilter filter,
                  ResourceFilter recurseFilter,
                  URL... urls)
Description copied from class: Module
Visit the resources in this module using the given filter(s)

Typically the filter is used to determine which types of files to visit, e.g. .class files. While the recurseFilter determines which jars/directories to recurse into.

Overrides:
visit in class Module
Parameters:
visitor - the visitor
filter - the filter
recurseFilter - the recursion filter (null means recurse into everything)
urls - the urls we should visit

visitPath

protected void visitPath(File file,
                         String path,
                         ResourceVisitor visitor,
                         ResourceFilter filter,
                         ResourceFilter recurseFilter,
                         ClassLoader classLoader,
                         Collection<String> included,
                         ClassFilter includedFilter,
                         Collection<String> excluded,
                         ClassFilter excludedFilter,
                         ResourceContext context)
Visit path.

Parameters:
file - the current path file
path - the path
visitor - the visitor
filter - the filter
recurseFilter - the recurse filter
classLoader - the classloader
included - the included
includedFilter - the included filter
excluded - the excluded
excludedFilter - the excluded filter
context - the current context

includePath

protected boolean includePath(String path,
                              Collection<String> included,
                              ClassFilter includedFilter,
                              Collection<String> excluded,
                              ClassFilter excludedFilter)
Should we include path in visit.

Parameters:
path - the path
included - the included
includedFilter - the included filter
excluded - the excluded
excludedFilter - the excluded filter
Returns:
true if path should be included in visit

determineCapabilities

protected List<Capability> determineCapabilities()
Description copied from class: Module
Determine the capabilities

Overrides:
determineCapabilities in class ClassLoadingMetaDataModule
Returns:
the capabilities

setKernelControllerContext

public void setKernelControllerContext(org.jboss.kernel.spi.dependency.KernelControllerContext context)
                                throws Exception
Specified by:
setKernelControllerContext in interface org.jboss.kernel.spi.dependency.KernelControllerContextAware
Throws:
Exception

unsetKernelControllerContext

public void unsetKernelControllerContext(org.jboss.kernel.spi.dependency.KernelControllerContext context)
                                  throws Exception
Specified by:
unsetKernelControllerContext in interface org.jboss.kernel.spi.dependency.KernelControllerContextAware
Throws:
Exception

getClassLoadingMetaData

protected MockClassLoadingMetaData getClassLoadingMetaData()
Description copied from class: ClassLoadingMetaDataModule
Get the classloading metadata

Overrides:
getClassLoadingMetaData in class ClassLoadingMetaDataModule
Returns:
the metadata

getPolicy

public MockClassLoaderPolicy getPolicy()
Description copied from class: ClassLoaderPolicyModule
Get the policy

Overrides:
getPolicy in class ClassLoaderPolicyModule
Returns:
the policy

determinePolicy

protected MockClassLoaderPolicy determinePolicy()
Description copied from class: ClassLoaderPolicyModule
Determine the classloader policy

Specified by:
determinePolicy in class ClassLoaderPolicyModule
Returns:
the policy


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.