001    /*
002     *   Copyright (c) 2009 The JOMC Project
003     *   Copyright (c) 2005 Christian Schulte <cs@jomc.org>
004     *   All rights reserved.
005     *
006     *   Redistribution and use in source and binary forms, with or without
007     *   modification, are permitted provided that the following conditions
008     *   are met:
009     *
010     *     o Redistributions of source code must retain the above copyright
011     *       notice, this list of conditions and the following disclaimer.
012     *
013     *     o Redistributions in binary form must reproduce the above copyright
014     *       notice, this list of conditions and the following disclaimer in
015     *       the documentation and/or other materials provided with the
016     *       distribution.
017     *
018     *   THIS SOFTWARE IS PROVIDED BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS"
019     *   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
020     *   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
021     *   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR
022     *   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
023     *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024     *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
025     *   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
026     *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
027     *   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
028     *   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029     *
030     *   $Id: ModelObjectValidator.java 891 2009-11-02 03:40:00Z schulte2005 $
031     *
032     */
033    package org.jomc.model;
034    
035    import javax.xml.bind.JAXBContext;
036    import javax.xml.bind.JAXBElement;
037    import javax.xml.bind.JAXBException;
038    import javax.xml.validation.Schema;
039    
040    /**
041     * Validates object management and configuration model objects.
042     *
043     * @author <a href="mailto:cs@jomc.org">Christian Schulte</a>
044     * @version $Id: ModelObjectValidator.java 891 2009-11-02 03:40:00Z schulte2005 $
045     */
046    public interface ModelObjectValidator
047    {
048    
049        /**
050         * Validates a given model object to conform to a given schema using a given context.
051         *
052         * @param modelObject The model object to validate.
053         * @param context The context to use for validating {@code modelObject}.
054         * @param schema The schema to use for validating {@code modelObect}.
055         *
056         * @return Report about the given model object.
057         *
058         * @throws NullPointerException if {@code modelObject}, {@code context} or {@code schema} is {@code null}.
059         * @throws JAXBException if validation fails.
060         *
061         * @see ModelManager#getContext(java.lang.ClassLoader)
062         * @see ModelManager#getSchema(java.lang.ClassLoader)
063         * @see ModelObjectValidationReport#isModelObjectValid()
064         */
065        ModelObjectValidationReport validateModelObject( JAXBElement modelObject, JAXBContext context, Schema schema )
066            throws NullPointerException, JAXBException;
067    
068        /**
069         * Validates a given list of modules to conform to a given schema using a given context and to form a valid object
070         * management and configuration runtime model.
071         *
072         * @param modules The modules to validate.
073         * @param context The context to use for validating {@code modules}.
074         * @param schema The schema to use for validating {@code modules}.
075         *
076         * @return Report about the given modules.
077         *
078         * @throws NullPointerException if {@code modules}, {@code context} or {@code schema} is {@code null}.
079         * @throws JAXBException if validation fails.
080         *
081         * @see ModelManager#getContext(java.lang.ClassLoader)
082         * @see ModelManager#getSchema(java.lang.ClassLoader)
083         * @see ModelObjectValidationReport#isModelObjectValid()
084         */
085        ModelObjectValidationReport validateModules( JAXBElement<Modules> modules, JAXBContext context, Schema schema )
086            throws NullPointerException, JAXBException;
087    
088    }