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 *    http://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.shared.ldap.extras.controls.syncrepl_impl;
021
022
023import org.apache.directory.shared.asn1.ber.AbstractContainer;
024import org.apache.directory.shared.ldap.codec.api.LdapApiService;
025
026
027/**
028 * 
029 * ASN.1 container for SyncDoneValueControl.
030 *
031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
032 */
033public class SyncDoneValueContainer extends AbstractContainer
034{
035    /** syncDoneValue*/
036    private SyncDoneValueDecorator control;
037
038    private LdapApiService codec;
039    
040    
041    /**
042     * 
043     * Creates a new SyncDoneValueControlContainer object.
044     *
045     */
046    public SyncDoneValueContainer( LdapApiService codec )
047    {
048        super();
049        this.codec = codec;
050        this.control = new SyncDoneValueDecorator( codec );
051        stateStack = new int[1];
052        grammar = SyncDoneValueGrammar.getInstance();
053        setTransition( SyncDoneValueStatesEnum.START_STATE );
054    }
055
056
057    /**
058     * 
059     * Creates a new SyncDoneValueControlContainer object.
060     *
061     */
062    public SyncDoneValueContainer( LdapApiService codec, SyncDoneValueDecorator control )
063    {
064        super();
065        this.codec = codec;
066        this.control = control;
067        stateStack = new int[1];
068        grammar = SyncDoneValueGrammar.getInstance();
069        setTransition( SyncDoneValueStatesEnum.START_STATE );
070    }
071
072
073    /**
074     * @return the SyncDoneValueControlCodec object
075     */
076    public SyncDoneValueDecorator getSyncDoneValueControl()
077    {
078        return control;
079    }
080
081
082    /**
083     * Set a SyncDoneValueControlCodec Object into the container. It will be completed
084     * by the ldapDecoder.
085     * 
086     * @param control the SyncDoneValueControlCodec to set.
087     */
088    public void setSyncDoneValueControl( SyncDoneValueDecorator control )
089    {
090        this.control = control;
091    }
092
093    
094    public LdapApiService getCodecService()
095    {
096        return codec;
097    }
098    
099
100    /**
101     * clean the container
102     */
103    @Override
104    public void clean()
105    {
106        super.clean();
107        control = null;
108    }
109
110}