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.codec.controls.search.subentries; 21 22 23 import org.apache.directory.api.asn1.ber.AbstractContainer; 24 25 26 /** 27 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 28 */ 29 public class SubentriesContainer extends AbstractContainer 30 { 31 /** PSearchControl */ 32 private SubentriesDecorator decorator; 33 34 35 /** 36 * Creates a new SubEntryControlContainer object. 37 */ 38 public SubentriesContainer() 39 { 40 super(); 41 setGrammar( SubentriesGrammar.getInstance() ); 42 setTransition( SubentriesStates.START_STATE ); 43 } 44 45 46 /** 47 * Creates a new SubEntryControlContainer object, pre-populating it with the 48 * supplied Subentries control, and optionally wrapping it with a decorator 49 * if it is not a decorator instance. 50 * 51 * @param control The Subentries Control to decorate and add to this 52 * container, or if the Control already is a ControlDecorator it is directly 53 * added. 54 */ 55 public SubentriesContainer( SubentriesDecorator control ) 56 { 57 this(); 58 this.decorator = control; 59 } 60 61 62 /** 63 * @return Returns the persistent search control. 64 */ 65 public SubentriesDecorator getSubentriesControl() 66 { 67 return decorator; 68 } 69 70 71 /** 72 * Set a SubEntryControl Object into the container. It will be completed by 73 * the ldapDecoder. 74 * 75 * @param decorator the SubEntryControl to set. 76 */ 77 public void setSubentriesDecorator( SubentriesDecorator decorator ) 78 { 79 this.decorator = decorator; 80 } 81 82 83 /** 84 * Clean the current container 85 */ 86 @Override 87 public void clean() 88 { 89 super.clean(); 90 decorator = null; 91 } 92 }