com.vaadin.flow.server.osgi.

Class OSGiAccess


  • public final class OSGiAccess
    extends Object

    Manages scanned classes inside OSGi container.

    It doesn't do anything outside of OSGi.

    Since:

    1.2

    Author:

    Vaadin Ltd

    See Also:

    getInstance()

    • Method Detail

      • getInstance

        public static OSGiAccess getInstance()

        Gets the singleton instance.

        Returns:

        the singleton instance

      • getOsgiServletContext

        public ServletContext getOsgiServletContext()

        Gets a servlet context instance which is used to track registries which are storage of scanned classes.

        This is not a real servlet context. It's just a proxied unique instance which is used to be able to access registries in a generic way via some getInstance(ServletContext) method.

        Returns:

      • setServletContainerInitializers

        public void setServletContainerInitializers(Collection<Class<? extends ServletContainerInitializer>> contextInitializers)

        Sets the discovered servlet context initializer classes.

        The OSGi bundle tracker is used to scan all classes in bundles and it also scans flow-server module for servlet initializer classes. They are set using this method once they are collected.

        Parameters:

        contextInitializers - servlet context initializer classes

      • hasInitializers

        public boolean hasInitializers()

        Checks whether the servlet initializers are discovered.

        Returns:

        true if servlet initializers are set, false otherwise

      • addScannedClasses

        public void addScannedClasses(Map<Long,Collection<Class<?>>> extenderClasses)

        Adds scanned classes in active bundles.

        The map contains a bundle id as a key and classes discovered in the bundle as a value.

        Parameters:

        extenderClasses - a map with discovered classes in active bundles

      • removeScannedClasses

        public void removeScannedClasses(Long bundleId)

        Removes classes from the bundle identified by the bundleId.

        When a bundle becomes inactive its classes should not be used anymore. This method removes the classes from the bundle from the collection of discovered classes.

        Parameters:

        bundleId - the bundle identifier