Class XmlSchemaValidatorImpl

    • Constructor Detail

      • XmlSchemaValidatorImpl

        public XmlSchemaValidatorImpl()
    • Method Detail

      • init

        public void init()
                  throws CoreException
        Description copied from interface: ComponentLifecycle
        Initialises the component.

        Component initialisation includes config verification, creation of connections etc.

        Throws:
        CoreException - wrapping any underlying Exceptions
      • start

        public void start()
                   throws CoreException
        Description copied from interface: ComponentLifecycle
        Starts the component.

        Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer, calling start will begin message delivery.

        Throws:
        CoreException - wrapping any underlying Exceptions
      • stop

        public void stop()
        Description copied from interface: ComponentLifecycle
        Stop the component

        A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer, calling stop will pause message delivery. Throwing a RuntimeException may cause unintended consequences

      • close

        public void close()
        Description copied from interface: ComponentLifecycle
        Closes the component.

        A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException may cause unintended consequences

      • resolveSchema

        protected javax.xml.validation.Schema resolveSchema​(AdaptrisMessage msg)
                                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • resolveFromCache

        protected javax.xml.validation.Schema resolveFromCache​(java.lang.String urlString)
                                                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setSchema

        public void setSchema​(java.lang.String s)
        Sets the schema to validate against. May not be null or empty.
        Parameters:
        s - the schema to validate against, normally a URL.
      • getSchema

        public java.lang.String getSchema()
        Returns the schema to validate against.
        Returns:
        the schema to validate against
      • setSchemaCache

        public void setSchemaCache​(AdaptrisConnection cache)
        Configure the internal cache for schemas.

        While it is possible to configure a distributed cache (a-la ehcache or JSR107) the Schema object isn't serializable, so you may run into issues. It will be best to stick with ExpiringMapCache if you want to enable caching. The default behaviour is to cache 16 schemas for a max of 2 hours (last-access) if you don't explicitly configure it differently.

        Parameters:
        cache - the cache, generally a CacheConnection or SharedConnection.