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.asn1.DecoderException; 24 import org.apache.directory.api.ldap.model.message.ExtendedRequest; 25 import org.apache.directory.api.ldap.model.message.ExtendedResponse; 26 27 28 /** 29 * The factory interface, defined by the codec API, for creating new 30 * requests/responses for extended operations. 31 * 32 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 33 * @version $Rev$, $Date$ 34 */ 35 public interface ExtendedOperationFactory 36 { 37 /** 38 * Gets the OID of the extended requests this factory generates. 39 * 40 * @return the extended request OID 41 */ 42 String getOid(); 43 44 45 /** 46 * Returns a new {@link ExtendedRequestDecorator} with the following encoded value. 47 * 48 * @param value the encoded value 49 * @return the decorator for the extended request type 50 */ 51 ExtendedRequest newRequest( byte[] value ); 52 53 54 /** 55 * Decorates a non-decorated request. 56 * 57 * @param modelRequest the non decorated model request 58 * @return the decorated model request 59 */ 60 ExtendedRequest decorate( ExtendedRequest modelRequest ); 61 62 63 /** 64 * Creates a new ExtendedResponse, for the ExtendedRequest with a specific 65 * encoded value. 66 * 67 * @param encodedValue The encoded value for the ExtendedResponse instance. 68 * @return The new ExtendedResponse. 69 */ 70 ExtendedResponse newResponse( byte[] encodedValue ) throws DecoderException; 71 72 73 /** 74 * Decorates an ExtendedResponse which may or may not be of the expected 75 * type. The factory implementor must check and handle appropriately. 76 * 77 * @param decoratedMessage the message to be decorated. 78 * @return The decorated message 79 */ 80 ExtendedResponse decorate( ExtendedResponse decoratedMessage ); 81 }