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
022import org.apache.directory.api.asn1.DecoderException;
023import org.apache.directory.api.asn1.util.Asn1Buffer;
024import org.apache.directory.api.ldap.model.message.ExtendedRequest;
025import org.apache.directory.api.ldap.model.message.ExtendedResponse;
026import org.slf4j.Logger;
027import org.slf4j.LoggerFactory;
028
029/**
030 * A Factory to encode Extended Request and Response messages
031 * 
032 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
033 */
034public abstract class AbstractExtendedOperationFactory implements ExtendedOperationFactory
035{
036    /** logger for reporting errors that might not be handled properly upstream */
037    protected  static final Logger LOG = LoggerFactory.getLogger( AbstractExtendedOperationFactory.class );
038    
039    /** The LDAP codec responsible for encoding and decoding */
040    protected LdapApiService codec;
041    
042    /** The extended operation OID */
043    protected String oid;
044
045    /**
046     *
047     * Creates a new instance of AbstractExtendedOperationFactory.
048     *
049     * @param codec The LdapApiService instance
050     * @param oid The extended operation OID
051     */
052    protected AbstractExtendedOperationFactory( LdapApiService codec, String oid )
053    {
054        this.codec = codec;
055        this.oid = oid;
056    }
057    
058    
059    /**
060     * {@inheritDoc}
061     */
062    @Override
063    public String getOid()
064    {
065        return oid;
066    }
067
068
069    /**
070     * {@inheritDoc}
071     */
072    @Override
073    public ExtendedRequest newRequest( byte[] value ) throws DecoderException
074    {
075        return null;
076    }
077
078
079    /**
080     * {@inheritDoc}
081     */
082    @Override
083    public ExtendedResponse newResponse( byte[] value ) throws DecoderException
084    {
085        return null;
086    }
087
088
089    /**
090     * {@inheritDoc}
091     */
092    @Override
093    public void encodeValue( Asn1Buffer buffer, ExtendedRequest extendedRequest )
094    {
095        // Nothing to do by default
096    }
097
098
099    /**
100     * {@inheritDoc}
101     */
102    @Override
103    public void decodeValue( ExtendedRequest extendedRequest, byte[] requestValue ) throws DecoderException
104    {
105        // Nothing to do by default
106    }
107
108
109    /**
110     * {@inheritDoc}
111     */
112    @Override
113    public void encodeValue( Asn1Buffer buffer, ExtendedResponse extendedResponse )
114    {
115        // Nothing to do by default
116    }
117
118
119    /**
120     * {@inheritDoc}
121     */
122    @Override
123    public void decodeValue( ExtendedResponse extendedResponse, byte[] responseValue ) throws DecoderException
124    {
125        // Nothing to do by default
126    }
127}