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.api; 21 22 23 import org.apache.directory.api.ldap.model.message.Control; 24 25 26 /** 27 * Implementors of new codec control extensions must implement a factory using 28 * this factory interface, Factory implementations for specific controls are 29 * then registered with the codec and used by the codec to encode and decode 30 * those controls. 31 * 32 * @param <C> The Control to create 33 * 34 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 35 */ 36 public interface ControlFactory<C extends Control> 37 { 38 /** 39 * @return The OID of the Control this factory creates. 40 */ 41 String getOid(); 42 43 44 /** 45 * Creates and returns a decorated version of the Control. 46 * 47 * @return The {@link CodecControl} decorated version of the Control. 48 */ 49 CodecControl<C> newCodecControl(); 50 51 52 /** 53 * Decorates an existing control. Implementors should check to make sure 54 * the supplied Control has not already been decorated to prevent needless 55 * decorator nesting. 56 * 57 * @param control The {@link Control} to be decorated. 58 * @return The decorator wrapping the Control. 59 */ 60 CodecControl<C> newCodecControl( C control ); 61 }