1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.ldap.model.schema.parsers;
21
22
23 import java.text.ParseException;
24
25 import org.apache.directory.api.i18n.I18n;
26 import org.apache.directory.api.ldap.model.schema.MatchingRuleUse;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30 import antlr.RecognitionException;
31 import antlr.TokenStreamException;
32
33
34
35
36
37
38
39 public class MatchingRuleUseDescriptionSchemaParser extends AbstractSchemaParser
40 {
41
42 protected static final Logger LOG = LoggerFactory.getLogger( MatchingRuleUseDescriptionSchemaParser.class );
43
44
45
46
47
48 public MatchingRuleUseDescriptionSchemaParser()
49 {
50 }
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73 public synchronized MatchingRuleUse parseMatchingRuleUseDescription( String matchingRuleUseDescription )
74 throws ParseException
75 {
76 LOG.debug( "Parsing a MatchingRuleUse : {}", matchingRuleUseDescription );
77
78 if ( matchingRuleUseDescription == null )
79 {
80 LOG.error( I18n.err( I18n.ERR_04245 ) );
81 throw new ParseException( "Null", 0 );
82 }
83
84 reset( matchingRuleUseDescription );
85
86 try
87 {
88 MatchingRuleUse matchingRuleUse = parser.matchingRuleUseDescription();
89
90
91 updateSchemaName( matchingRuleUse );
92
93 return matchingRuleUse;
94 }
95 catch ( RecognitionException re )
96 {
97 String msg = I18n.err( I18n.ERR_04246, matchingRuleUseDescription, re.getMessage(), re.getColumn() );
98 LOG.error( msg );
99 throw new ParseException( msg, re.getColumn() );
100 }
101 catch ( TokenStreamException tse )
102 {
103 String msg = I18n.err( I18n.ERR_04247, matchingRuleUseDescription, tse.getMessage() );
104 LOG.error( msg );
105 throw new ParseException( msg, 0 );
106 }
107
108 }
109
110
111
112
113
114
115
116
117
118 public MatchingRuleUse parse( String schemaDescription ) throws ParseException
119 {
120 return parseMatchingRuleUseDescription( schemaDescription );
121 }
122 }