Class BasePackageScanResolver

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.StatefulService, org.apache.camel.SuspendableService
    Direct Known Subclasses:
    DefaultPackageScanClassResolver, DefaultPackageScanResourceResolver

    public abstract class BasePackageScanResolver
    extends org.apache.camel.support.service.ServiceSupport
    implements org.apache.camel.CamelContextAware
    Base class for package scan resolvers.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String[] acceptableSchemes  
      protected org.slf4j.Logger log  
      • Fields inherited from class org.apache.camel.support.service.BaseService

        BUILDED, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTINGDOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addClassLoader​(ClassLoader classLoader)  
      protected URL customResourceLocator​(URL url)  
      org.apache.camel.CamelContext getCamelContext()  
      Set<ClassLoader> getClassLoaders()  
      protected Enumeration<URL> getResources​(ClassLoader loader, String packageName)
      Strategy to get the resources by the given classloader.
      protected boolean isAcceptableScheme​(String urlPath)  
      void setAcceptableSchemes​(String schemes)
      To specify a set of accepted schemas to use for loading resources as URL connections (besides http and https schemas)
      void setCamelContext​(org.apache.camel.CamelContext camelContext)  
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
      • Methods inherited from interface org.apache.camel.Service

        build, close, init, start, stop
      • Methods inherited from interface org.apache.camel.ShutdownableService

        shutdown
      • Methods inherited from interface org.apache.camel.StatefulService

        getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
      • Methods inherited from interface org.apache.camel.SuspendableService

        isSuspended, resume, suspend
    • Field Detail

      • log

        protected final org.slf4j.Logger log
      • acceptableSchemes

        protected String[] acceptableSchemes
    • Constructor Detail

      • BasePackageScanResolver

        public BasePackageScanResolver()
    • Method Detail

      • getCamelContext

        public org.apache.camel.CamelContext getCamelContext()
        Specified by:
        getCamelContext in interface org.apache.camel.CamelContextAware
      • setCamelContext

        public void setCamelContext​(org.apache.camel.CamelContext camelContext)
        Specified by:
        setCamelContext in interface org.apache.camel.CamelContextAware
      • addClassLoader

        public void addClassLoader​(ClassLoader classLoader)
      • setAcceptableSchemes

        public void setAcceptableSchemes​(String schemes)
        To specify a set of accepted schemas to use for loading resources as URL connections (besides http and https schemas)
      • isAcceptableScheme

        protected boolean isAcceptableScheme​(String urlPath)
      • getResources

        protected Enumeration<URL> getResources​(ClassLoader loader,
                                                String packageName)
                                         throws IOException
        Strategy to get the resources by the given classloader.

        Notice that in WebSphere platforms there is a WebSpherePackageScanClassResolver to take care of WebSphere's oddity of resource loading.

        Parameters:
        loader - the classloader
        packageName - the packagename for the package to load
        Returns:
        URL's for the given package
        Throws:
        IOException - is thrown by the classloader