View Javadoc

1   package org.codehaus.xfire.service;
2   
3   import java.util.Collection;
4   
5   import org.codehaus.xfire.service.event.RegistrationEventListener;
6   
7   /***
8    * Defines the interface that for places to register, unregister, and get information about services.
9    *
10   * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
11   * @author <a href="mailto:poutsma@mac.com">Arjen Poutsma</a>
12   */
13  public interface ServiceRegistry
14  {
15      /***
16       * Constant used to define the role of service registries.
17       */
18      public static final String ROLE = ServiceRegistry.class.getName();
19  
20      /***
21       * Returns the <code>ServiceEndpoint</code> with the given name, if found. Returns <code>null</code> if not found.
22       *
23       * @param name the service name.
24       * @return the service endpoint, or <code>null</code> if not found.
25       */
26      Service getService(String name);
27  
28      /***
29       * Registers a given <code>ServiceEndpoint</code> with this registry.
30       *
31       * @param endpoint the endpoint.
32       */
33      void register(Service endpoint);
34  
35      /***
36       * Unregisters the service endpoint with the given name, if found.
37       *
38       * @param name the service name.
39       */
40      void unregister(String name);
41  
42      /***
43       * Indicates whether this registry has a service endpoint with the given name.
44       *
45       * @param name the service name.
46       * @return <code>true</code> if this registry has a service with the given name; <code>false</code> otherwise.
47       */
48      boolean hasService(String name);
49  
50      /***
51       * Returns all <code>ServiceEndpoint</code> registered to this registry.
52       *
53       * @return all service endpoints.
54       */
55      Collection getServices();
56  
57      /***
58       * Add a listener for registration events.
59       *
60       * @param listener the listener.
61       */
62      void addRegistrationEventListener(RegistrationEventListener listener);
63  
64      /***
65       * Remove a listener for registration events.
66       *
67       * @param listener the listener.
68       */
69      void removeRegistrationEventListener(RegistrationEventListener listener);
70  }