View Javadoc

1   /*
2    *   @(#) $Id: ServiceRegistry.java 210062 2005-07-11 03:52:38Z 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 akarasulu@apache.org
35   * @author trustin@apache.org
36   * @version $Rev: 210062 $, $Date: 2005-07-11 12:52:38 +0900 $
37   */
38  public interface ServiceRegistry
39  {
40      /***
41       * Binds the specified I/O handler to the specified service.
42       */
43      void bind( Service service, IoHandler ioHandler ) throws IOException;
44  
45      /***
46       * Binds the specified protocol provider to the specified service.
47       */
48      void bind( Service service, ProtocolProvider protocolProvider )
49              throws IOException;
50  
51      /***
52       * Unbinds the specified service (and its aggregated I/O handler or
53       * protocol provider). 
54       */
55      void unbind( Service service );
56      
57      /***
58       * Unbinds all services (and their aggregated I/O handlers or
59       * protocol providers). 
60       */
61      void unbindAll();
62  
63      /***
64       * Returns {@link Set} of all services bound in this registry.
65       */
66      Set getAllServices();
67      
68      /***
69       * Returns {@link Set} of services bound in this registry with the
70       * specified service(or protocol) name.
71       */
72      Set getServices(String name);
73  
74      /***
75       * Returns {@link Set} of services bound in this registry with the
76       * specified transport type.
77       */
78      Set getServices(TransportType transportType);
79      
80      /***
81       * Returns {@link Set} of services bound in this registry with the
82       * specified port number.
83       */
84      Set getServices(int port);
85  
86      IoAcceptor getIoAcceptor( TransportType transportType );
87      
88      ProtocolAcceptor getProtocolAcceptor( TransportType transportType );
89  }