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     * Creates a new SyncDoneValueControlContainer object.
044     *
045     * @param codec The LDAP Service to use
046     */
047    public SyncDoneValueContainer( LdapApiService codec )
048    {
049        super();
050        this.codec = codec;
051        this.control = new SyncDoneValueDecorator( codec );
052        setGrammar( SyncDoneValueGrammar.getInstance() );
053        setTransition( SyncDoneValueStatesEnum.START_STATE );
054    }
055
056
057    /**
058     * Creates a new SyncDoneValueControlContainer object.
059     *
060     * @param codec The LDAP Service to use
061     * @param control The control to decorate
062     */
063    public SyncDoneValueContainer( LdapApiService codec, SyncDoneValue control )
064    {
065        super();
066        this.codec = codec;
067        this.control = control;
068        setGrammar( SyncDoneValueGrammar.getInstance() );
069        setTransition( SyncDoneValueStatesEnum.START_STATE );
070    }
071
072
073    /**
074     * @return the SyncDoneValueControlCodec object
075     */
076    public SyncDoneValue 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( SyncDoneValue control )
089    {
090        this.control = control;
091    }
092
093
094    /**
095     * @return The LDAP API service
096     */
097    public LdapApiService getCodecService()
098    {
099        return codec;
100    }
101
102
103    /**
104     * clean the container
105     */
106    @Override
107    public void clean()
108    {
109        super.clean();
110        control = null;
111    }
112
113}