Class AbstractLocationPropertiesSource

  • All Implemented Interfaces:
    AutoCloseable, LocationPropertiesSource, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.LoadablePropertiesSource, org.apache.camel.spi.PropertiesSource, org.apache.camel.StatefulService, org.apache.camel.SuspendableService
    Direct Known Subclasses:
    ClasspathPropertiesSource, FilePropertiesSource

    public abstract class AbstractLocationPropertiesSource
    extends org.apache.camel.support.service.ServiceSupport
    implements org.apache.camel.spi.LoadablePropertiesSource, LocationPropertiesSource
    Base class for LoadablePropertiesSource which can load properties from a source such as classpath or file system.
    • Field Summary

      • 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 Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doInit()  
      PropertiesLocation getLocation()
      Gets the location of the properties
      String getProperty​(String name)  
      Properties loadProperties()  
      Properties loadProperties​(Predicate<String> filter)  
      protected static Properties prepareLoadedProperties​(Properties properties)
      Strategy to prepare loaded properties before being used by Camel.
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, doBuild, doFail, 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.spi.PropertiesSource

        getName
      • 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
    • Method Detail

      • loadProperties

        public Properties loadProperties()
        Specified by:
        loadProperties in interface org.apache.camel.spi.LoadablePropertiesSource
      • loadProperties

        public Properties loadProperties​(Predicate<String> filter)
        Specified by:
        loadProperties in interface org.apache.camel.spi.LoadablePropertiesSource
      • getProperty

        public String getProperty​(String name)
        Specified by:
        getProperty in interface org.apache.camel.spi.PropertiesSource
      • doInit

        protected void doInit()
                       throws Exception
        Overrides:
        doInit in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • prepareLoadedProperties

        protected static Properties prepareLoadedProperties​(Properties properties)
        Strategy to prepare loaded properties before being used by Camel.

        This implementation will ensure values are trimmed, as loading properties from a file with values having trailing spaces is not automatic trimmed by the Properties API from the JDK.

        Parameters:
        properties - the properties
        Returns:
        the prepared properties