View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *
10   *    https://www.apache.org/licenses/LICENSE-2.0
11   *
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License.
18   *
19   */
20  package org.apache.directory.api.ldap.extras.controls.ad_impl;
21  
22  
23  import org.apache.directory.api.asn1.ber.grammar.AbstractGrammar;
24  import org.apache.directory.api.asn1.ber.grammar.Grammar;
25  import org.apache.directory.api.asn1.ber.grammar.GrammarTransition;
26  import org.apache.directory.api.asn1.ber.tlv.UniversalTag;
27  import org.slf4j.Logger;
28  import org.slf4j.LoggerFactory;
29  
30  
31  /**
32   * The AdPolicyHints grammar
33   *
34   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
35   */
36  public final class AdPolicyHintsGrammar extends AbstractGrammar<AdPolicyHintsContainer>
37  {
38      static final Logger LOG = LoggerFactory.getLogger( AdPolicyHintsGrammar.class );
39  
40      private static Grammar<?> instance = new AdPolicyHintsGrammar();
41  
42  
43      @SuppressWarnings("unchecked")
44      private AdPolicyHintsGrammar()
45      {
46          setName( AdPolicyHintsGrammar.class.getName() );
47  
48          super.transitions = new GrammarTransition[AdPolicyHintsStates.END_STATE.ordinal()][256];
49  
50          super.transitions[AdPolicyHintsStates.START_STATE.ordinal()][UniversalTag.SEQUENCE
51              .getValue()] = new GrammarTransition<AdPolicyHintsContainer>(
52                  AdPolicyHintsStates.START_STATE, AdPolicyHintsStates.AD_POLICY_HINTS_SEQUENCE_STATE,
53                  UniversalTag.SEQUENCE.getValue(), null );
54  
55          super.transitions[AdPolicyHintsStates.AD_POLICY_HINTS_SEQUENCE_STATE.ordinal()][UniversalTag.INTEGER
56              .getValue()] = new GrammarTransition<AdPolicyHintsContainer>(
57                  AdPolicyHintsStates.AD_POLICY_HINTS_SEQUENCE_STATE,
58                  AdPolicyHintsStates.AD_POLICY_HINTS_FLAGS_STATE, UniversalTag.INTEGER.getValue(),
59                  new StoreFlags() );
60      }
61  
62  
63      /**
64       * @return the singleton instance of the AdPolicyHintsGrammar
65       */
66      public static Grammar<?> getInstance()
67      {
68          return instance;
69      }
70  }