Class ScanningAppProvider

All Implemented Interfaces:
AppProvider, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle
Direct Known Subclasses:
ContextProvider

@ManagedObject("Abstract Provider for loading webapps") public abstract class ScanningAppProvider extends ContainerLifeCycle implements AppProvider
  • Constructor Details

    • ScanningAppProvider

      protected ScanningAppProvider()
    • ScanningAppProvider

      protected ScanningAppProvider(FilenameFilter filter)
  • Method Details

    • getEnvironmentName

      public String getEnvironmentName()
      Specified by:
      getEnvironmentName in interface AppProvider
      Returns:
      The name of the Environment this provider is for.
    • setEnvironmentName

      public void setEnvironmentName(String environmentName)
    • isUseRealPaths

      public boolean isUseRealPaths()
      Returns:
      True if the real path of the scanned files should be used for deployment.
    • setUseRealPaths

      public void setUseRealPaths(boolean useRealPaths)
      Parameters:
      useRealPaths - True if the real path of the scanned files should be used for deployment.
    • setFilenameFilter

      protected void setFilenameFilter(FilenameFilter filter)
    • getDeployedApps

      protected Map<Path,App> getDeployedApps()
      Returns:
      The index of currently deployed applications.
    • createApp

      protected App createApp(Path path)
      Called by the Scanner.DiscreteListener to create a new App object. Isolated in a method so that it is possible to override the default App object for specialized implementations of the AppProvider.
      Parameters:
      path - The file that is the context.xml. It is resolved by ResourceFactory.newResource(String)
      Returns:
      The App object for this particular context definition file.
    • doStart

      protected void doStart() throws Exception
      Description copied from class: ContainerLifeCycle
      Starts the managed lifecycle beans in the order they were added.
      Overrides:
      doStart in class ContainerLifeCycle
      Throws:
      AbstractLifeCycle.StopException - If thrown, the lifecycle will immediately be stopped.
      Exception - If there was a problem starting. Will cause a transition to FAILED state
    • doStop

      protected void doStop() throws Exception
      Description copied from class: ContainerLifeCycle
      Stops the managed lifecycle beans in the reverse order they were added.
      Overrides:
      doStop in class ContainerLifeCycle
      Throws:
      Exception - If there was a problem stopping. Will cause a transition to FAILED state
    • exists

      protected boolean exists(String path)
    • pathAdded

      protected void pathAdded(Path path) throws Exception
      Throws:
      Exception
    • pathChanged

      protected void pathChanged(Path path) throws Exception
      Throws:
      Exception
    • pathRemoved

      protected void pathRemoved(Path path) throws Exception
      Throws:
      Exception
    • getDeploymentManager

      public DeploymentManager getDeploymentManager()
      Get the deploymentManager.
      Returns:
      the deploymentManager
    • getMonitoredDirResource

      public Resource getMonitoredDirResource()
    • getMonitoredDirName

      public String getMonitoredDirName()
    • getScanInterval

      @ManagedAttribute("scanning interval to detect changes which need reloaded") public int getScanInterval()
    • setDeploymentManager

      public void setDeploymentManager(DeploymentManager deploymentManager)
      Description copied from interface: AppProvider
      Set the Deployment Manager
      Specified by:
      setDeploymentManager in interface AppProvider
      Parameters:
      deploymentManager - the deployment manager
    • setMonitoredResources

      public void setMonitoredResources(List<Resource> resources)
    • getMonitoredResources

      public List<Resource> getMonitoredResources()
    • setMonitoredDirResource

      public void setMonitoredDirResource(Resource resource)
    • addScannerListener

      public void addScannerListener(Scanner.Listener listener)
    • setMonitoredDirName

      public void setMonitoredDirName(String dir)
      Parameters:
      dir - Directory to scan for context descriptors or war files
    • setMonitoredDirectories

      public void setMonitoredDirectories(Collection<String> directories)
    • isDeferInitialScan

      public boolean isDeferInitialScan()
      Test if initial scan should be deferred.
      Returns:
      true if initial scan is deferred, false to have initial scan occur on startup of ScanningAppProvider.
    • setDeferInitialScan

      public void setDeferInitialScan(boolean defer)
      Flag to control initial scan behavior.
      • true - to have initial scan deferred until the Server component has reached it's STARTED state.
        Note: any failures in a deploy will not fail the Server startup in this mode.
      • false - (default value) to have initial scan occur as normal on ScanningAppProvider startup.
      Parameters:
      defer - true to defer initial scan, false to have initial scan occur on startup of ScanningAppProvider.
    • setScanInterval

      public void setScanInterval(int scanInterval)
    • scan

      @ManagedOperation(value="Scan the monitored directories", impact="ACTION") public void scan()
    • toString

      public String toString()
      Overrides:
      toString in class AbstractLifeCycle