Package org.apache.tapestry5.services.pageload

# Interface PageClassLoaderContextManager

All Known Implementing Classes:
  `PageClassLoaderContextManagerImpl`

public interface PageClassLoaderContextManager
Service that creates PageClassLoaderContext instances (except the root one) when a class in a controlled page is first used in the Tapestry page pool. Existing contexts may be reused for a given class, specially when in production mode.

Since:
  5.8.3
See Also:
  - `ComponentInstantiatorSource`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  Clears any state held by this manager.
  `void`
  `clear(String className)`
  Removes one specific class from this manager, invalidating the context where it is.
  `PageClassLoaderContext`
  `get(String className)`
  Processes a class, given its class name and the root context.
  `Class<?>`
  `getClassInstance(Class<?> clasz, String pageName)`
  Returns the Class instance appropriate for a given component given a page name.
  `PageClassLoaderContext`
  `getRoot()`
  Returns the root context.
  `void`
  `initialize(PageClassLoaderContext root, Function<ClassLoader,PlasticProxyFactory> plasticProxyFactoryProvider)`
  Initializes this service with the root context and a Plastic proxy factory provider.
  `Set<String>`
  `invalidate(PageClassLoaderContext... contexts)`
  Invalidates page classloader contexts and returns a set containing the names of all classes that should be invalidated.
  `void`
  `invalidateAndFireInvalidationEvents(PageClassLoaderContext... contexts)`
  Invalidates page classloader contexts and invalidates the classes in the context as well.
  `void`
  `invalidateUnknownContext()`
  Invalidates the "unknown" page classloader context context.
  `boolean`
  `isMerging()`
  Returns whether contexts are being merged.
  `void`
  `preload()`
  Preloads all data, first by collecting dependency data for all existing pages and the components, mixins and superclasses they use, then creating the page classloader contexts.
  `void`
  `preloadContexts()`
  Preloads the page classloader contexts.

- ## Method Details

  - ### get

    PageClassLoaderContext get(String className)
    Processes a class, given its class name and the root context.
    Parameters:
      `className` - the class fully qualified name. ClassLoader} and returns a new PlasticProxyFactory.
    Returns:
      the `PageClassLoaderContext` associated with that class.

  - ### invalidate

    Set<String> invalidate(PageClassLoaderContext... contexts)
    Invalidates page classloader contexts and returns a set containing the names of all classes that should be invalidated.

  - ### invalidateAndFireInvalidationEvents

    void invalidateAndFireInvalidationEvents(PageClassLoaderContext... contexts)
    Invalidates page classloader contexts and invalidates the classes in the context as well.

  - ### getRoot

    PageClassLoaderContext getRoot()
    Returns the root context.

  - ### clear

    void clear()
    Clears any state held by this manager.

  - ### isMerging

    boolean isMerging()
    Returns whether contexts are being merged.

  - ### clear

    void clear(String className)
    Removes one specific class from this manager, invalidating the context where it is.

  - ### initialize

    void initialize(PageClassLoaderContext root, Function<ClassLoader,PlasticProxyFactory> plasticProxyFactoryProvider)
    Initializes this service with the root context and a Plastic proxy factory provider. Method can only be called once. None of the parameters may be null.

  - ### getClassInstance

    Class<?> getClassInstance(Class<?> clasz, String pageName)
    Returns the Class instance appropriate for a given component given a page name.
    Parameters:
      `clasz` - the class instance.
      `pageName` - the page name.
    Returns:
      a Class instance.

  - ### invalidateUnknownContext

    void invalidateUnknownContext()
    Invalidates the "unknown" page classloader context context.

  - ### preload

    void preload()
    Preloads all data, first by collecting dependency data for all existing pages and the components, mixins and superclasses they use, then creating the page classloader contexts.

  - ### preloadContexts

    void preloadContexts()
    Preloads the page classloader contexts.
    Since:
      5.8.7