<commit_before>/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *  
 *    http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License. 
 *  
 */
package org.apache.mina.handler.multiton;

import org.apache.mina.common.IdleStatus;
import org.apache.mina.common.IoHandler;
import org.apache.mina.common.IoSession;

/**
 * An {@link IoHandler} implementation which delegates all requests to
 * {@link SingleSessionIoHandler}s.  A {@link SingleSessionIoHandlerFactory}
 * is used to create a new {@link SingleSessionIoHandler} for each newly
 * created session.
 * 
 * @author The Apache Directory Project (<EMAIL>)
 * @version $Rev$, $Date$
 */
public class SingleSessionIoHandlerDelegate implements IoHandler
{
    /**
     * The key used to store the {@link SingleSessionIoHandler} as a session
     * attribute.
     */
    public static final String HANDLER =
        SingleSessionIoHandlerDelegate.class.getName() + ".handler";

    /**
     * The {@link SingleSessionIoHandlerFactory} used to create new
     * {@link SingleSessionIoHandler}s.
     */
    private final SingleSessionIoHandlerFactory factory;

    /**
     * Creates a new instance that uses the passed in
     * {@link SingleSessionIoHandlerFactory} to create new
     * {@link SingleSessionIoHandler}s.
     * 
     * @param factory  the factory for {@link SingleSessionIoHandler}s
     */
    public SingleSessionIoHandlerDelegate( SingleSessionIoHandlerFactory factory )
    {
        if (factory == null)
        {
            throw new NullPointerException("factory");
        }
        this.factory = factory;
    }

    /**
     * Creates a new instance with the factory passed to the constructor of
     * this class.  The created handler is stored as a session
     * attribute named {@link #HANDLER}.
     * 
     * @see org.apache.mina.common.IoHandler#sessionCreated(org.apache.mina.common.IoSession)
     */
    public void sessionCreated(IoSession session) throws Exception 
    {<commit_msg>Fixed issue DIRMINA-315 (Add SingleIoSessionHandlerDelegate.getFactory()) * Added getFactory()<commit_after>/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *  
 *    http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License. 
 *  
 */
package org.apache.mina.handler.multiton;

import org.apache.mina.common.IdleStatus;
import org.apache.mina.common.IoHandler;
import org.apache.mina.common.IoSession;

/**
 * An {@link IoHandler} implementation which delegates all requests to
 * {@link SingleSessionIoHandler}s.  A {@link SingleSessionIoHandlerFactory}
 * is used to create a new {@link SingleSessionIoHandler} for each newly
 * created session.
 * 
 * @author The Apache Directory Project (<EMAIL>)
 * @version $Rev$, $Date$
 */
public class SingleSessionIoHandlerDelegate implements IoHandler
{
    /**
     * The key used to store the {@link SingleSessionIoHandler} as a session
     * attribute.
     */
    public static final String HANDLER =
        SingleSessionIoHandlerDelegate.class.getName() + ".handler";

    /**
     * The {@link SingleSessionIoHandlerFactory} used to create new
     * {@link SingleSessionIoHandler}s.
     */
    private final SingleSessionIoHandlerFactory factory;

    /**
     * Creates a new instance that uses the passed in
     * {@link SingleSessionIoHandlerFactory} to create new
     * {@link SingleSessionIoHandler}s.
     * 
     * @param factory  the factory for {@link SingleSessionIoHandler}s
     */
    public SingleSessionIoHandlerDelegate( SingleSessionIoHandlerFactory factory )
    {
        if (factory == null)
        {
            throw new NullPointerException("factory");
        }
        this.factory = factory;
    }
    
    /**
     * Returns the {@link SingleSessionIoHandlerFactory} that is used to create a new
     * {@link SingleSessionIoHandler} instance.
     */
    public SingleSessionIoHandlerFactory getFactory()
    {
        return factory;
    }

    /**
     * Creates a new instance with the factory passed to the constructor of
     * this class.  The created handler is stored as a session
     * attribute named {@link #HANDLER}.
     * 
     * @see org.apache.mina.common.IoHandler#sessionCreated(org.apache.mina.common.IoSession)
     */
    public void sessionCreated(IoSession session) throws Exception 
    {
{'fraction_non_alphanumeric': 0.08095740936290038, 'fraction_numerical': 0.0019359380499824005, 'mean_word_length': 3.20962962962963, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4944540', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1457, 'n_words': 551}