Package psiprobe

Interface TomcatContainer

  • All Known Implementing Classes:
    AbstractTomcatContainer

    public interface TomcatContainer
    Part of Tomcat container version abstraction layer.
    • Method Detail

      • findContext

        org.apache.catalina.Context findContext​(String name)
        Finds a context based on its path.
        Parameters:
        name - the context path
        Returns:
        the context deployed to that path
      • formatContextName

        String formatContextName​(String name)
        Formats a context name to a path that the container will recognize. Usually this means prepending a / character, although there is special behavior for the root context.
        Parameters:
        name - the context name
        Returns:
        the context name formatted as the container expects
      • formatContextFilename

        String formatContextFilename​(String contextName)
        Formats a context name so that it can be used as a step for the context descriptor .xml or deployed .war file. Usually this means stripping a leading / character, although there is special behavior for the root context.
        Parameters:
        contextName - the context name
        Returns:
        the filename stem for this context
      • findContexts

        List<org.apache.catalina.Context> findContexts()
        Find contexts.
        Returns:
        all contexts
      • findConnectors

        List<org.apache.catalina.connector.Connector> findConnectors()
        Find connectors.
        Returns:
        all connectors
      • stop

        void stop​(String name)
           throws Exception
        Stops the context with the given name.
        Parameters:
        name - the name of the context to stop
        Throws:
        Exception - if stopping the context fails spectacularly
      • start

        void start​(String name)
            throws Exception
        Starts the context with the given name.
        Parameters:
        name - the name of the context to start
        Throws:
        Exception - if starting the context fails spectacularly
      • remove

        void remove​(String name)
             throws Exception
        Undeploys a context.
        Parameters:
        name - the context path
        Throws:
        Exception - if undeployment fails spectacularly
      • installWar

        void installWar​(String name,
                        URL url)
                 throws Exception
        Installs .war file at the given context name.
        Parameters:
        name - the name of the context
        url - pointer to .war file to be deployed
        Throws:
        Exception - if installing the .war fails spectacularly
      • getAppBase

        File getAppBase()
        This method always returns absolute path, no matter what Tomcat is up to.
        Returns:
        absolute path to applications base (normally "webapps")
      • getConfigFile

        File getConfigFile​(org.apache.catalina.Context context)
        Returns the context descriptor filename for the given context.
        Parameters:
        context - the context
        Returns:
        the context descriptor filename, or null
      • getConfigBase

        String getConfigBase()
        Gets the config base.
        Returns:
        the config base
      • setWrapper

        void setWrapper​(org.apache.catalina.Wrapper wrapper)
        Sets the wrapper.
        Parameters:
        wrapper - the new wrapper
      • canBoundTo

        boolean canBoundTo​(String binding)
        Indicates whether this adapter can bind to the container.
        Parameters:
        binding - the ServerInfo of the container
        Returns:
        true if binding is possible
      • installContext

        boolean installContext​(String contextName)
                        throws Exception
        Deploys a context, assuming an context descriptor file exists on the server already.
        Parameters:
        contextName - the context path, which should match the filename
        Returns:
        true if deployment was successful
        Throws:
        Exception - if deployment fails spectacularly
      • listContextJsps

        void listContextJsps​(org.apache.catalina.Context context,
                             Summary summary,
                             boolean compile)
        Lists and optionally compiles all JSPs for the given context. Compilation details are added to the summary.
        Parameters:
        context - the context
        summary - the summary in which the output is stored
        compile - whether to compile all of the JSPs or not
      • recompileJsps

        void recompileJsps​(org.apache.catalina.Context context,
                           Summary summary,
                           List<String> names)
        Compiles a list of JSPs. Names of JSP files are expected to be relative to the webapp root. The method updates summary with compilation details.
        Parameters:
        context - the context
        summary - the summary in which the output is stored
        names - the list of JSPs to compile
      • discardWorkDir

        void discardWorkDir​(org.apache.catalina.Context context)
        Deletes the "work" directory of the given context.
        Parameters:
        context - the context
      • getHostName

        String getHostName()
        Gets the host name.
        Returns:
        the host name
      • getName

        String getName()
        Gets the name.
        Returns:
        the name
      • getServletFileNameForJsp

        String getServletFileNameForJsp​(org.apache.catalina.Context context,
                                        String jspName)
        Returns the JSP servlet filename for the given JSP file.
        Parameters:
        context - the context
        jspName - the JSP filename
        Returns:
        the name of the JSP servlet
      • getApplicationFilterMaps

        List<FilterMapping> getApplicationFilterMaps​(org.apache.catalina.Context context)
        Gets the application filter maps.
        Parameters:
        context - the context
        Returns:
        the application filter maps
      • getAvailable

        boolean getAvailable​(org.apache.catalina.Context context)
        Gets the available.
        Parameters:
        context - the context
        Returns:
        the available
      • addContextResource

        void addContextResource​(org.apache.catalina.Context context,
                                List<ApplicationResource> resourceList,
                                boolean contextBound)
        Adds the context resource.
        Parameters:
        context - the context
        resourceList - the resource list
        contextBound - the context bound
      • addContextResourceLink

        void addContextResourceLink​(org.apache.catalina.Context context,
                                    List<ApplicationResource> resourceList,
                                    boolean contextBound)
        Adds the context resource link.
        Parameters:
        context - the context
        resourceList - the resource list
        contextBound - the context bound
      • getApplicationFilters

        List<FilterInfo> getApplicationFilters​(org.apache.catalina.Context context)
        Gets the application filters.
        Parameters:
        context - the context
        Returns:
        the application filters
      • getApplicationInitParams

        List<ApplicationParam> getApplicationInitParams​(org.apache.catalina.Context context)
        Gets the application init params.
        Parameters:
        context - the context
        Returns:
        the application init params
      • resourceExists

        boolean resourceExists​(String name,
                               org.apache.catalina.Context context)
        Resource exists.
        Parameters:
        name - the name
        context - the context
        Returns:
        true, if successful
      • getResourceStream

        InputStream getResourceStream​(String name,
                                      org.apache.catalina.Context context)
                               throws IOException
        Gets the resource stream.
        Parameters:
        name - the name
        context - the context
        Returns:
        the resource stream
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • getResourceAttributes

        Long[] getResourceAttributes​(String name,
                                     org.apache.catalina.Context context)
        Gets the resource attributes.
        Parameters:
        name - the name
        context - the context
        Returns:
        the resource attributes
      • bindToContext

        void bindToContext​(org.apache.catalina.Context context)
                    throws NamingException
        Binds a naming context to the current thread's classloader.
        Parameters:
        context - the catalina context
        Throws:
        NamingException - if binding the classloader fails
      • unbindFromContext

        void unbindFromContext​(org.apache.catalina.Context context)
                        throws NamingException
        Unbinds a naming context from the current thread's classloader.
        Parameters:
        context - the catalina context
        Throws:
        NamingException - if unbinding the classloader fails