001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * https://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020package org.apache.directory.api.ldap.extras.controls.ad_impl; 021 022 023import org.apache.directory.api.asn1.ber.grammar.AbstractGrammar; 024import org.apache.directory.api.asn1.ber.grammar.Grammar; 025import org.apache.directory.api.asn1.ber.grammar.GrammarTransition; 026import org.apache.directory.api.asn1.ber.tlv.UniversalTag; 027import org.slf4j.Logger; 028import org.slf4j.LoggerFactory; 029 030 031/** 032 * The AdPolicyHints grammar 033 * 034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 035 */ 036public final class AdPolicyHintsGrammar extends AbstractGrammar<AdPolicyHintsContainer> 037{ 038 static final Logger LOG = LoggerFactory.getLogger( AdPolicyHintsGrammar.class ); 039 040 private static Grammar<?> instance = new AdPolicyHintsGrammar(); 041 042 043 @SuppressWarnings("unchecked") 044 private AdPolicyHintsGrammar() 045 { 046 setName( AdPolicyHintsGrammar.class.getName() ); 047 048 super.transitions = new GrammarTransition[AdPolicyHintsStates.END_STATE.ordinal()][256]; 049 050 super.transitions[AdPolicyHintsStates.START_STATE.ordinal()][UniversalTag.SEQUENCE 051 .getValue()] = new GrammarTransition<AdPolicyHintsContainer>( 052 AdPolicyHintsStates.START_STATE, AdPolicyHintsStates.AD_POLICY_HINTS_SEQUENCE_STATE, 053 UniversalTag.SEQUENCE.getValue(), null ); 054 055 super.transitions[AdPolicyHintsStates.AD_POLICY_HINTS_SEQUENCE_STATE.ordinal()][UniversalTag.INTEGER 056 .getValue()] = new GrammarTransition<AdPolicyHintsContainer>( 057 AdPolicyHintsStates.AD_POLICY_HINTS_SEQUENCE_STATE, 058 AdPolicyHintsStates.AD_POLICY_HINTS_FLAGS_STATE, UniversalTag.INTEGER.getValue(), 059 new StoreFlags() ); 060 } 061 062 063 /** 064 * @return the singleton instance of the AdPolicyHintsGrammar 065 */ 066 public static Grammar<?> getInstance() 067 { 068 return instance; 069 } 070}