KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > ejb > cmp3 > xml > XMLValidator


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.internal.ejb.cmp3.xml;
23
24 import java.lang.reflect.AnnotatedElement JavaDoc;
25
26 import oracle.toplink.essentials.exceptions.ValidationException;
27 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataValidator;
28
29 import org.w3c.dom.Document JavaDoc;
30
31 /**
32  * Validator class for the EntityMappingsXMLProcessor and the
33  * XMLSequencingProcessor.
34  *
35  * @author Guy Pelletier
36  * @since TopLink EJB 3.0 Reference Implementation
37  */

38 public class XMLValidator extends MetadataValidator {
39     public XMLValidator() {}
40     
41     /**
42      * INTERNAL
43      */

44     public void throwEmbeddedIdAndIdFound(Class JavaDoc entityClass, String JavaDoc attributeName, String JavaDoc idAttributeName) {
45         throw ValidationException.embeddedIdAndIdElementFound(entityClass, attributeName, idAttributeName);
46     }
47     
48     /**
49      * INTERNAL
50      */

51     public void throwErrorProcessingNamedQueryElement(String JavaDoc queryName, Exception JavaDoc exception) {
52         throw ValidationException.errorProcessingNamedQueryElement(queryName, exception);
53     }
54     
55     /**
56      * INTERNAL
57      */

58     public void throwExcessiveJoinColumnsSpecified(Class JavaDoc entityClass, Object JavaDoc element) {
59         throw ValidationException.excessiveJoinColumnElementsSpecified((String JavaDoc) element, entityClass);
60     }
61     
62     /**
63      * INTERNAL
64      */

65     public void throwExcessivePrimaryKeyJoinColumnsSpecified(Class JavaDoc entityClass, AnnotatedElement JavaDoc annotatedElement) {
66         throw ValidationException.excessivePrimaryKeyJoinColumnElementsSpecified(entityClass);
67     }
68     
69     /**
70      * INTERNAL
71      */

72     public void throwIncompleteJoinColumnsSpecified(Class JavaDoc entityClass, Object JavaDoc element) {
73         throw ValidationException.incompleteJoinColumnElementsSpecified(element, entityClass);
74     }
75     
76     /**
77      * INTERNAL
78      */

79     public void throwIncompletePrimaryKeyJoinColumnsSpecified(Class JavaDoc entityClass, AnnotatedElement JavaDoc annotatedElement) {
80         throw ValidationException.incompletePrimaryKeyJoinColumnElementsSpecified(entityClass);
81     }
82     
83     /**
84      * INTERNAL
85      */

86     public void throwMultipleEmbeddedIdsFound(Class JavaDoc entityClass, String JavaDoc attributeName, String JavaDoc embeddedIdAttributeName) {
87         throw ValidationException.multipleEmbeddedIdElementsFound(entityClass, attributeName, embeddedIdAttributeName);
88     }
89     
90     /**
91      * INTERNAL
92      */

93     public void throwNoMappedByAttributeFound(Class JavaDoc owningClass, String JavaDoc owningAttributeName, Class JavaDoc entityClass, String JavaDoc attributeName) {
94         // ignore, not applicable.
95
}
96     
97     /**
98      * INTERNAL
99      */

100     public void throwNoTemporalTypeSpecified(Class JavaDoc entityClass, String JavaDoc attributeName) {
101         // WIP - copied from AnnotationsValidator ... might need to have its own ...
102
throw ValidationException.noTemporalTypeSpecified(attributeName, entityClass);
103     }
104     
105     /**
106      * INTERNAL
107      */

108     public void throwPersistenceUnitMetadataConflict(String JavaDoc element) {
109         throw ValidationException.persistenceUnitMetadataConflict(element);
110     }
111     
112     /**
113      * INTERNAL
114      */

115     public void throwRelationshipHasColumnSpecified(Class JavaDoc entityClass, String JavaDoc attributeName) {
116         throw ValidationException.invalidColumnElementOnRelationship(entityClass, attributeName);
117     }
118     
119     /**
120      * INTERNAL:
121      */

122     public void throwSequenceGeneratorUsingAReservedName(String JavaDoc document, String JavaDoc reservedName) {
123         throw ValidationException.sequenceGeneratorUsingAReservedName(reservedName, document);
124     }
125     
126     /**
127      * INTERNAL:
128      */

129     public void throwTableGeneratorUsingAReservedName(String JavaDoc document, String JavaDoc reservedName) {
130         throw ValidationException.tableGeneratorUsingAReservedName(reservedName, document);
131     }
132     
133     /**
134      * INTERNAL
135      */

136     public void throwUniDirectionalOneToManyHasJoinColumnSpecified(Class JavaDoc entityClass, String JavaDoc attributeName) {
137         throw ValidationException.uniDirectionalOneToManyHasJoinColumnElements(entityClass, attributeName);
138     }
139 }
140
Popular Tags