KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > rmi > registry > NamingService


1 /***
2  * Fractal RMI: a binder for remote method calls between Fractal components.
3  * Copyright (C) 2003 France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: Eric.Bruneton@rd.francetelecom.com
20  *
21  * Author: Bruno Dillenseger
22  */

23
24 package org.objectweb.fractal.rmi.registry;
25
26 import org.objectweb.fractal.api.Component;
27
28 /**
29  * Typical naming service interface, inspired from Java RMI Registry's
30  * interface. Note: be careful with term "bind", which is not used here as
31  * Fractal's concept about linking interfaces, but as the basic naming service
32  * concept of associating a name with a server reference.
33  */

34
35 public interface NamingService {
36
37   /**
38    * Interface name for naming service.
39    */

40
41   static final public String JavaDoc NAMING_SERVICE = "naming service";
42
43   /**
44    * Gets the list of names currently present in the naming service.
45    *
46    * @return an array of names.
47    */

48
49   String JavaDoc[] list ();
50
51   /**
52    * Looks for a component.
53    *
54    * @param name the name to look for.
55    * @return the component associated to the given name.
56    */

57
58   Component lookup (String JavaDoc name);
59
60   /**
61    * Associates the given name with the given component, if and only
62    * if the given name is not already in use in the naming service.
63    *
64    * @param name name to be associated to the component.
65    * @param comp component to be associated to the given name.
66    * @return <tt>true</tt> if the name has been added to the naming service,
67    * <tt>false</tt> otherwise.
68    */

69
70   boolean bind (String JavaDoc name, Component comp);
71
72   /**
73    * Associates the given name with the given component, replacing
74    * any existing association using the same name.
75    *
76    * @param name name to be associated to the component.
77    * @param comp component to be associated to the given name.
78    * @return the component formerly associated to the given name, or
79    * <tt>null</tt> if the given name is new to the naming service.
80    */

81
82   Component rebind (String JavaDoc name, Component comp);
83
84   /**
85    * Removes a name from the naming service.
86    *
87    * @param name to remove.
88    * @return the component that was associated to the name, or
89    * <tt>null</tt> if the name was not known by the naming service.
90    */

91
92   Component unbind (String JavaDoc name);
93 }
94
Popular Tags