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 * @param codec The LDAP Service to use 046 */ 047 public SyncInfoValueContainer( LdapApiService codec ) 048 { 049 super(); 050 this.codec = codec; 051 this.control = new SyncInfoValueDecorator( codec ); 052 setGrammar( SyncInfoValueGrammar.getInstance() ); 053 setTransition( SyncInfoValueStatesEnum.START_STATE ); 054 } 055 056 057 /** 058 * Creates a new SyncInfoValueControlContainer object. We will store one grammar, 059 * it's enough ... 060 * 061 * @param codec The LDAP Service to use 062 * @param control The control to decorate 063 */ 064 public SyncInfoValueContainer( LdapApiService codec, SyncInfoValue control ) 065 { 066 super(); 067 this.codec = codec; 068 this.control = control; 069 setGrammar( SyncInfoValueGrammar.getInstance() ); 070 setTransition( SyncInfoValueStatesEnum.START_STATE ); 071 } 072 073 074 /** 075 * @return Returns the syncInfoValue control. 076 */ 077 public SyncInfoValue getSyncInfoValueControl() 078 { 079 return control; 080 } 081 082 083 /** 084 * Set a SyncInfoValueControl Object into the container. It will be completed by 085 * the ldapDecoder. 086 * 087 * @param control the SyncInfoValueControlCodec to set. 088 */ 089 public void setSyncInfoValueControl( SyncInfoValue control ) 090 { 091 this.control = control; 092 } 093 094 095 /** 096 * @return The LDAP API service 097 */ 098 public LdapApiService getCodecService() 099 { 100 return codec; 101 } 102 103 104 /** 105 * Clean the container 106 */ 107 @Override 108 public void clean() 109 { 110 super.clean(); 111 control = null; 112 } 113}