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.shared.ldap.codec.protocol.mina;
021
022
023import org.apache.mina.core.session.IoSession;
024import org.apache.mina.filter.codec.ProtocolCodecFactory;
025import org.apache.mina.filter.codec.ProtocolDecoder;
026import org.apache.mina.filter.codec.ProtocolEncoder;
027
028
029/**
030 * The factory used to create the LDAP encoder and decoder.
031 *
032 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
033 */
034public class LdapProtocolCodecFactory implements ProtocolCodecFactory
035{
036    /** The tag stored into the session if we want to set a max PDU size */
037    public final static String MAX_PDU_SIZE = "MAX_PDU_SIZE";
038
039    /** The LdapDecoder key */
040    public static final String LDAP_DECODER = "LDAP_DECODER";
041
042    /** The LdapEncoder key */
043    public static final String LDAP_ENCODER = "LDAP_ENCODER";
044
045    
046    /**
047     * Get the LDAP decoder.
048     *
049     * @param session the IO session
050     * @return the decoder
051     */
052    public ProtocolDecoder getDecoder( IoSession session )
053    {
054        return new LdapProtocolDecoder();
055    }
056
057
058    /**
059     * Get the LDAP encoder.
060     *
061     * @param session the IO session
062     * @return the encoder
063     */
064    public ProtocolEncoder getEncoder( IoSession session )
065    {
066        return new LdapProtocolEncoder();
067    }
068}