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