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.syncInfoValue.SyncInfoValue;
026
027
028/**
029 * A container for the SyncInfoValue control
030 *  
031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
032 */
033public class SyncInfoValueContainer extends AbstractContainer
034{
035    /** SyncInfoValueControl */
036    private SyncInfoValue control;
037
038    private LdapApiService codec;
039
040
041    /**
042     * Creates a new SyncInfoValueControlContainer object. We will store one grammar,
043     * it's enough ...
044     */
045    public SyncInfoValueContainer( LdapApiService codec )
046    {
047        super();
048        this.codec = codec;
049        this.control = new SyncInfoValueDecorator( codec );
050        grammar = SyncInfoValueGrammar.getInstance();
051        setTransition( SyncInfoValueStatesEnum.START_STATE );
052    }
053
054
055    /**
056     * Creates a new SyncInfoValueControlContainer object. We will store one grammar,
057     * it's enough ...
058     */
059    public SyncInfoValueContainer( LdapApiService codec, SyncInfoValue control )
060    {
061        super();
062        this.codec = codec;
063        this.control = control;
064        grammar = SyncInfoValueGrammar.getInstance();
065        setTransition( SyncInfoValueStatesEnum.START_STATE );
066    }
067
068
069    /**
070     * @return Returns the syncInfoValue control.
071     */
072    public SyncInfoValue getSyncInfoValueControl()
073    {
074        return control;
075    }
076
077
078    /**
079     * Set a SyncInfoValueControl Object into the container. It will be completed by
080     * the ldapDecoder.
081     * 
082     * @param control the SyncInfoValueControlCodec to set.
083     */
084    public void setSyncInfoValueControl( SyncInfoValue control )
085    {
086        this.control = control;
087    }
088
089
090    public LdapApiService getCodecService()
091    {
092        return codec;
093    }
094
095
096    /**
097     * Clean the container
098     */
099    public void clean()
100    {
101        super.clean();
102        control = null;
103    }
104}