View Javadoc

1   /*
2    *   @(#) $Id: ServiceRegistry.java 332218 2005-11-10 03:52:42Z trustin $
3    *
4    *   Copyright 2004 The Apache Software Foundation
5    *
6    *   Licensed under the Apache License, Version 2.0 (the "License");
7    *   you may not use this file except in compliance with the License.
8    *   You may obtain a copy of the License at
9    *
10   *       http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *   Unless required by applicable law or agreed to in writing, software
13   *   distributed under the License is distributed on an "AS IS" BASIS,
14   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *   See the License for the specific language governing permissions and
16   *   limitations under the License.
17   *
18   */
19  package org.apache.mina.registry;
20  
21  import java.io.IOException;
22  import java.util.Set;
23  
24  import org.apache.mina.common.TransportType;
25  import org.apache.mina.io.IoAcceptor;
26  import org.apache.mina.io.IoHandler;
27  import org.apache.mina.protocol.ProtocolAcceptor;
28  import org.apache.mina.protocol.ProtocolProvider;
29  
30  /***
31   * Interface for the internet service registry. The registry is used by MINA
32   * to associate services with ports and transport protocols.
33   * 
34   * @author The Apache Directory Project (dev@directory.apache.org)
35   * @version $Rev: 332218 $, $Date: 2005-11-10 12:52:42 +0900 $
36   */
37  public interface ServiceRegistry
38  {
39      /***
40       * Binds the specified I/O handler to the specified service.
41       */
42      void bind( Service service, IoHandler ioHandler ) throws IOException;
43  
44      /***
45       * Binds the specified protocol provider to the specified service.
46       */
47      void bind( Service service, ProtocolProvider protocolProvider )
48              throws IOException;
49  
50      /***
51       * Unbinds the specified service (and its aggregated I/O handler or
52       * protocol provider). 
53       */
54      void unbind( Service service );
55      
56      /***
57       * Unbinds all services (and their aggregated I/O handlers or
58       * protocol providers). 
59       */
60      void unbindAll();
61  
62      /***
63       * Returns {@link Set} of all services bound in this registry.
64       */
65      Set getAllServices();
66      
67      /***
68       * Returns {@link Set} of services bound in this registry with the
69       * specified service(or protocol) name.
70       */
71      Set getServices(String name);
72  
73      /***
74       * Returns {@link Set} of services bound in this registry with the
75       * specified transport type.
76       */
77      Set getServices(TransportType transportType);
78      
79      /***
80       * Returns {@link Set} of services bound in this registry with the
81       * specified port number.
82       */
83      Set getServices(int port);
84  
85      IoAcceptor getIoAcceptor( TransportType transportType );
86      
87      ProtocolAcceptor getProtocolAcceptor( TransportType transportType );
88  }