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.codec.controls.search.subentries; 021 022 023import org.apache.directory.api.asn1.ber.AbstractContainer; 024 025 026/** 027 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 028 */ 029public class SubentriesContainer extends AbstractContainer 030{ 031 /** PSearchControl */ 032 private SubentriesDecorator decorator; 033 034 035 /** 036 * Creates a new SubEntryControlContainer object. 037 */ 038 public SubentriesContainer() 039 { 040 super(); 041 setGrammar( SubentriesGrammar.getInstance() ); 042 setTransition( SubentriesStates.START_STATE ); 043 } 044 045 046 /** 047 * Creates a new SubEntryControlContainer object, pre-populating it with the 048 * supplied Subentries control, and optionally wrapping it with a decorator 049 * if it is not a decorator instance. 050 * 051 * @param control The Subentries Control to decorate and add to this 052 * container, or if the Control already is a ControlDecorator it is directly 053 * added. 054 */ 055 public SubentriesContainer( SubentriesDecorator control ) 056 { 057 this(); 058 this.decorator = control; 059 } 060 061 062 /** 063 * @return Returns the persistent search control. 064 */ 065 public SubentriesDecorator getSubentriesControl() 066 { 067 return decorator; 068 } 069 070 071 /** 072 * Set a SubEntryControl Object into the container. It will be completed by 073 * the ldapDecoder. 074 * 075 * @param decorator the SubEntryControl to set. 076 */ 077 public void setSubentriesDecorator( SubentriesDecorator decorator ) 078 { 079 this.decorator = decorator; 080 } 081 082 083 /** 084 * Clean the current container 085 */ 086 @Override 087 public void clean() 088 { 089 super.clean(); 090 decorator = null; 091 } 092}