001    /*
002     * Copyright 2009 Red Hat, Inc.
003     * Red Hat licenses this file to you under the Apache License, version
004     * 2.0 (the "License"); you may not use this file except in compliance
005     * with the License.  You may obtain a copy of the License at
006     *    http://www.apache.org/licenses/LICENSE-2.0
007     * Unless required by applicable law or agreed to in writing, software
008     * distributed under the License is distributed on an "AS IS" BASIS,
009     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
010     * implied.  See the License for the specific language governing
011     * permissions and limitations under the License.
012     */
013    
014    package org.hornetq.spi.core.remoting;
015    
016    import java.util.Map;
017    import java.util.Set;
018    import java.util.concurrent.Executor;
019    import java.util.concurrent.ScheduledExecutorService;
020    
021    /**
022     * A ConnectorFactory is used by the client for creating connectors.
023     * <p/>
024     * A Connector is used to connect to an {@link org.hornetq.spi.core.remoting.Acceptor}.
025     *
026     * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
027     */
028    public interface ConnectorFactory
029    {
030       /**
031        * creates a new instance of a connector.
032        *
033        * @param configuration       the configuration
034        * @param handler             the handler
035        * @param listener            the listener
036        * @param closeExecutor       the close executor
037        * @param threadPool          the threadpool
038        * @param scheduledThreadPool the scheduled thread pool
039        * @return a new connector
040        */
041       Connector createConnector(Map<String, Object> configuration,
042                                 BufferHandler handler,
043                                 ConnectionLifeCycleListener listener,
044                                 Executor closeExecutor,
045                                 Executor threadPool,
046                                 ScheduledExecutorService scheduledThreadPool);
047    
048       /**
049        * Returns the allowable properties for this connector.
050        * <p/>
051        * This will differ between different connector implementations.
052        *
053        * @return the allowable properties.
054        */
055       Set<String> getAllowableProperties();
056    }