Class MetaData


  • public class MetaData
    extends java.lang.Object
    MetaData All data associated with the configuration and deployment of a web application.
    • Field Detail

      • NON_FRAG_RESOURCE

        public static final Resource NON_FRAG_RESOURCE
      • _webOverrideRoots

        protected final java.util.List<WebDescriptor> _webOverrideRoots
      • _metaDataComplete

        protected boolean _metaDataComplete
      • _descriptorProcessors

        protected final java.util.List<DescriptorProcessor> _descriptorProcessors
      • _webFragmentNameMap

        protected final java.util.Map<java.lang.String,​FragmentDescriptor> _webFragmentNameMap
      • _webInfClasses

        protected final java.util.List<Resource> _webInfClasses
      • _webInfJars

        protected final java.util.List<Resource> _webInfJars
      • _orderedContainerResources

        protected final java.util.List<Resource> _orderedContainerResources
      • _orderedWebInfResources

        protected final java.util.List<Resource> _orderedWebInfResources
      • _ordering

        protected Ordering _ordering
      • _allowDuplicateFragmentNames

        protected boolean _allowDuplicateFragmentNames
      • _validateXml

        protected boolean _validateXml
    • Constructor Detail

      • MetaData

        public MetaData()
    • Method Detail

      • clear

        public void clear()
        Empty ready for reuse
      • setDefaultsDescriptor

        public void setDefaultsDescriptor​(DefaultsDescriptor descriptor)
                                   throws java.lang.Exception
        Set the web-default.xml.
        Parameters:
        descriptor - the web-default.xml
        Throws:
        java.lang.Exception
      • setWebDescriptor

        public void setWebDescriptor​(WebDescriptor descriptor)
                              throws java.lang.Exception
        Parameters:
        descriptor - the web.xml descriptor
        Throws:
        java.lang.Exception
      • addOverrideDescriptor

        public void addOverrideDescriptor​(OverrideDescriptor descriptor)
                                   throws java.lang.Exception
        Add a override-web.xml descriptor.
        Parameters:
        descriptor - the override-web.xml
        Throws:
        java.lang.Exception
      • addFragmentDescriptor

        public void addFragmentDescriptor​(Resource jarResource,
                                          FragmentDescriptor descriptor)
                                   throws java.lang.Exception
        Add a web-fragment.xml, and the jar it is contained in.
        Parameters:
        jarResource - the jar of the fragment
        descriptor - web-fragment.xml
        Throws:
        java.lang.Exception - if unable to add fragment
      • addDiscoveredAnnotations

        public void addDiscoveredAnnotations​(java.util.List<DiscoveredAnnotation> annotations)
        Annotations such as WebServlet, WebFilter, WebListener that can be discovered by scanning unloaded classes.
        Parameters:
        annotations - the list of discovered annotations to add
      • addDiscoveredAnnotation

        public void addDiscoveredAnnotation​(DiscoveredAnnotation annotation)
        Add an annotation that has been discovered on a class, method or field within a resource eg a jar or dir. The annotation may also have no associated resource, or that resource may be a system or container resource. This method is synchronized as it is anticipated that it may be called by many threads during the annotation scanning phase.
        Parameters:
        annotation - the discovered annotation
      • orderFragments

        public void orderFragments()
      • resolve

        public void resolve​(WebAppContext context)
                     throws java.lang.Exception
        Resolve all servlet/filter/listener metadata from all sources: descriptors and annotations.
        Parameters:
        context - the context to resolve servlets / filters / listeners metadata from
        Throws:
        java.lang.Exception - if unable to resolve metadata
      • isDistributable

        public boolean isDistributable()
        A webapp is distributable if web.xml is metadata-complete and distributable=true, or if metadata-complete is false, but all web-fragments.xml are distributable=true.
        Returns:
        true if the webapp is distributable, false otherwise
      • getOverrideDescriptors

        public java.util.List<WebDescriptor> getOverrideDescriptors()
      • getDefaultsDescriptor

        public WebDescriptor getDefaultsDescriptor()
      • isOrdered

        public boolean isOrdered()
      • getOrdering

        public Ordering getOrdering()
      • setOrdering

        public void setOrdering​(Ordering o)
      • getFragmentDescriptor

        public FragmentDescriptor getFragmentDescriptor​(java.lang.String name)
        Parameters:
        name - the name specified in a web-fragment.xml
        Returns:
        the web-fragment.xml that defines that name or null
      • getFragmentDescriptor

        public FragmentDescriptor getFragmentDescriptor​(Resource descriptorResource)
        Parameters:
        descriptorResource - the web-fragment.xml location as a Resource
        Returns:
        the FrgmentDescriptor for the web-fragment.xml, or null if none exists
      • getJarForFragmentName

        public Resource getJarForFragmentName​(java.lang.String name)
        Parameters:
        name - the name specified in a web-fragment.xml
        Returns:
        the jar that contains the web-fragment.xml with the given name or null
      • getFragmentDescriptorForJar

        public FragmentDescriptor getFragmentDescriptorForJar​(Resource jar)
        Get the web-fragment.xml related to a jar
        Parameters:
        jar - the jar to check for a mapping to web-fragment.xml
        Returns:
        the FragmentDescriptor or null if no web-fragment.xml is associated with the jar
      • getNamedFragmentDescriptors

        public java.util.Map<java.lang.String,​FragmentDescriptor> getNamedFragmentDescriptors()
        Returns:
        a map of name to FragmentDescriptor, for those FragmentDescriptors that define a name element.
      • getOrigin

        public Origin getOrigin​(java.lang.String name)
      • getOriginDescriptor

        public Descriptor getOriginDescriptor​(java.lang.String name)
      • setOrigin

        public void setOrigin​(java.lang.String name,
                              Descriptor d)
      • setOrigin

        public void setOrigin​(java.lang.String name,
                              java.lang.annotation.Annotation annotation,
                              java.lang.Class<?> annotated)
      • setOriginAPI

        public void setOriginAPI​(java.lang.String name)
      • isMetaDataComplete

        public boolean isMetaDataComplete()
      • addWebInfResource

        public void addWebInfResource​(Resource newResource)
      • getWebInfResources

        public java.util.List<Resource> getWebInfResources​(boolean withOrdering)
      • getContainerResources

        public java.util.List<Resource> getContainerResources()
      • addContainerResource

        public void addContainerResource​(Resource jar)
      • setWebInfClassesResources

        public void setWebInfClassesResources​(java.util.List<Resource> dirs)
      • getWebInfClassesResources

        public java.util.List<Resource> getWebInfClassesResources()
      • isAllowDuplicateFragmentNames

        public boolean isAllowDuplicateFragmentNames()
      • setAllowDuplicateFragmentNames

        public void setAllowDuplicateFragmentNames​(boolean allowDuplicateFragmentNames)
      • isValidateXml

        public boolean isValidateXml()
        Returns:
        true if the parser validates, false otherwise
      • setValidateXml

        public void setValidateXml​(boolean validateXml)
        Parameters:
        validateXml - if true xml syntax is validated by the parser, false otherwise