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.ad_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.ad.AdDirSync; 026 027 028/** 029 * 030 * ASN.1 container for AD DirSync control. 031 * 032 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 033 */ 034public class AdDirSyncContainer extends AbstractContainer 035{ 036 /** adDirSync */ 037 private AdDirSync control; 038 039 private LdapApiService codec; 040 041 042 /** 043 * Creates a new AdDirSyncControl Container object. 044 * 045 * @param codec The LDAP Service to use 046 */ 047 public AdDirSyncContainer( LdapApiService codec ) 048 { 049 super(); 050 this.codec = codec; 051 this.control = new AdDirSyncDecorator( codec ); 052 setGrammar( AdDirSyncGrammar.getInstance() ); 053 setTransition( AdDirSyncStatesEnum.START_STATE ); 054 } 055 056 057 /** 058 * Creates a new AdDirSyncControl object. 059 * 060 * @param codec The LDAP Service to use 061 * @param control The AdDirSync control to decorate 062 */ 063 public AdDirSyncContainer( LdapApiService codec, AdDirSync control ) 064 { 065 super(); 066 this.codec = codec; 067 this.control = control; 068 setGrammar( AdDirSyncGrammar.getInstance() ); 069 setTransition( AdDirSyncStatesEnum.START_STATE ); 070 } 071 072 073 /** 074 * @return the AdDirSyncControlCodec object 075 */ 076 public AdDirSync getAdDirSyncControl() 077 { 078 return control; 079 } 080 081 082 /** 083 * Set a AdDirSyncControlCodec Object into the container. It will be completed 084 * by the ldapDecoder. 085 * 086 * @param control the AdDirSyncControlCodec to set. 087 */ 088 public void setAdDirSyncControl( AdDirSync control ) 089 { 090 this.control = control; 091 } 092 093 094 /** 095 * @return The LdapAPi service instance 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}