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.api; 021 022 023import org.apache.directory.api.asn1.DecoderException; 024import org.apache.directory.api.ldap.model.message.ExtendedRequest; 025import org.apache.directory.api.ldap.model.message.ExtendedResponse; 026 027 028/** 029 * The factory interface, defined by the codec API, for creating new 030 * requests/responses for extended operations. 031 * 032 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 033 * @version $Rev$, $Date$ 034 */ 035public interface ExtendedOperationFactory 036{ 037 /** 038 * Gets the OID of the extended requests this factory generates. 039 * 040 * @return the extended request OID 041 */ 042 String getOid(); 043 044 045 /** 046 * Returns a new {@link ExtendedRequestDecorator} with the following encoded value. 047 * 048 * @param value the encoded value 049 * @return the decorator for the extended request type 050 */ 051 ExtendedRequest newRequest( byte[] value ); 052 053 054 /** 055 * Decorates a non-decorated request. 056 * 057 * @param modelRequest the non decorated model request 058 * @return the decorated model request 059 */ 060 ExtendedRequest decorate( ExtendedRequest modelRequest ); 061 062 063 /** 064 * Creates a new ExtendedResponse, for the ExtendedRequest with a specific 065 * encoded value. 066 * 067 * @param encodedValue The encoded value for the ExtendedResponse instance. 068 * @return The new ExtendedResponse. 069 * @throws DecoderException If we can't decode the response 070 */ 071 ExtendedResponse newResponse( byte[] encodedValue ) throws DecoderException; 072 073 074 /** 075 * Decorates an ExtendedResponse which may or may not be of the expected 076 * type. The factory implementor must check and handle appropriately. 077 * 078 * @param decoratedMessage the message to be decorated. 079 * @return The decorated message 080 */ 081 ExtendedResponse decorate( ExtendedResponse decoratedMessage ); 082}