View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.api.ldap.extras.controls.ad;
21  
22  
23  import org.apache.directory.api.asn1.ber.AbstractContainer;
24  import org.apache.directory.api.ldap.codec.api.LdapApiService;
25  
26  
27  /**
28   * 
29   * ASN.1 container for AD DirSync control.
30   *
31   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
32   */
33  public class AdDirSyncContainer extends AbstractContainer
34  {
35      /** adDirSync */
36      private AdDirSync control;
37  
38      private LdapApiService codec;
39  
40  
41      /**
42       * 
43       * Creates a new AdDirSyncControl Container object.
44       *
45       */
46      public AdDirSyncContainer( LdapApiService codec )
47      {
48          super();
49          this.codec = codec;
50          this.control = new AdDirSyncDecorator( codec );
51          grammar = AdDirSyncGrammar.getInstance();
52          setTransition( AdDirSyncStatesEnum.START_STATE );
53      }
54  
55  
56      /**
57       * 
58       * Creates a new AdDirSyncControl object.
59       *
60       */
61      public AdDirSyncContainer( LdapApiService codec, AdDirSync control )
62      {
63          super();
64          this.codec = codec;
65          this.control = control;
66          grammar = AdDirSyncGrammar.getInstance();
67          setTransition( AdDirSyncStatesEnum.START_STATE );
68      }
69  
70  
71      /**
72       * @return the AdDirSyncControlCodec object
73       */
74      public AdDirSync getAdDirSyncControl()
75      {
76          return control;
77      }
78  
79  
80      /**
81       * Set a AdDirSyncControlCodec Object into the container. It will be completed
82       * by the ldapDecoder.
83       * 
84       * @param control the AdDirSyncControlCodec to set.
85       */
86      public void setAdDirSyncControl( AdDirSync control )
87      {
88          this.control = control;
89      }
90  
91  
92      public LdapApiService getCodecService()
93      {
94          return codec;
95      }
96  
97  
98      /**
99       * clean the container
100      */
101     @Override
102     public void clean()
103     {
104         super.clean();
105         control = null;
106     }
107 }