KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > mobilitools > smi > MAFFinder_impl


1 /*
2 * MobiliTools: an implementation of the Object Management Group's
3 * Mobile Agent Facility specification.
4 * Copyright (C) 2003 France Telecom R&D
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * MobiliTools $Name: $
21 *
22 * Contact: mobilitools-smi@lists.debian-sf.objectweb.org
23 *
24 * Authors: Bruno Dillenseger
25 */

26
27
28 package org.objectweb.mobilitools.smi;
29
30
31 import org.omg.CfMAF.*;
32 import org.omg.CORBA.*;
33 import org.objectweb.mobilitools.smi.idl.*;
34
35
36 /**
37  * MobiliTools $Name: $, $Id: MAFFinder_impl.java,v 1.1.1.1 2003/03/28 14:48:05 dillense Exp $
38  * <P>
39  * Implementation of MAF's MAFFinder interface.
40  * @see Finder
41 */

42 public class MAFFinder_impl extends _MAFFinderComplementImplBase
43     implements MAFFinderOperations, MAFFinderComplementOperations
44 {
45     Finder myFinder;
46
47
48     public MAFFinder_impl(Finder finder)
49     {
50         myFinder = finder;
51     }
52
53
54     ///////////////////////////////////////////////////////
55
// Implementation of MAF CORBA interface MAFFinder //
56
///////////////////////////////////////////////////////
57

58
59     /**
60         Registers an agent if its name is unique, and if its identity is not empty.
61     */

62     public void register_agent(
63         Name agent_name,
64         String JavaDoc agent_location,
65         AgentProfile agent_profile)
66         throws NameInvalid
67     {
68         myFinder.register(new FinderEntry(agent_name, agent_location, agent_profile));
69     }
70
71
72     /**
73         Registers an agent system if its name is unique, and if its identity is not empty.
74     */

75     public void register_agent_system(
76         Name agent_system_name,
77         String JavaDoc agent_system_location,
78         AgentSystemInfo agent_system_info)
79         throws NameInvalid
80     {
81         myFinder.register(new FinderEntry(agent_system_name, agent_system_location, agent_system_info));
82     }
83
84
85     /**
86         Not implemented.
87     */

88     public void register_place(
89         String JavaDoc place_name,
90         String JavaDoc place_location)
91         throws NameInvalid, NO_IMPLEMENT
92     {
93         throw new NO_IMPLEMENT("MAFFinder operations for place management are not implemented.");
94     }
95
96
97     /**
98         Lookup an agent from its name if the identity part is not empty,
99         or lists all agents otherwise.
100         @return location of agents
101     */

102     public String JavaDoc[] lookup_agent(
103         Name agent_name,
104         AgentProfile agent_profile)
105         throws EntryNotFound
106     {
107         return myFinder.lookup_locations(new org.objectweb.mobilitools.smi.api.Name(agent_name), null, agent_profile);
108     }
109
110
111     /**
112         Lookup an agent system from its name if the identity part is not empty,
113         or lists all agent systems otherwise.
114         @return location of agent systems
115     */

116     public String JavaDoc[] lookup_agent_system(
117         Name agent_system_name,
118         AgentSystemInfo agent_system_info)
119         throws EntryNotFound
120     {
121         return myFinder.lookup_locations(new org.objectweb.mobilitools.smi.api.Name(agent_system_name), null, agent_system_info);
122     }
123
124
125     /**
126         Not implemented.
127     */

128     public String JavaDoc[] lookup_place(String JavaDoc place_name)
129         throws EntryNotFound, NO_IMPLEMENT
130     {
131         throw new NO_IMPLEMENT("MAFFinder operations for place management are not implemented.");
132     }
133
134
135     /**
136         Unregisters an agent.
137     */

138     public void unregister_agent(Name agent_name)
139         throws EntryNotFound
140     {
141         myFinder.unregister(new org.objectweb.mobilitools.smi.api.Name(agent_name));
142     }
143
144
145     /**
146         Unregisters an agent system.
147     */

148     public void unregister_agent_system(Name agent_system_name)
149         throws EntryNotFound
150     {
151         myFinder.unregister(new org.objectweb.mobilitools.smi.api.Name(agent_system_name));
152     }
153
154
155     /**
156         Not implemented.
157     */

158     public void unregister_place(String JavaDoc place_name)
159         throws EntryNotFound, NO_IMPLEMENT
160     {
161         throw new NO_IMPLEMENT("MAFFinder operations for place management are not implemented.");
162     }
163
164
165     ///////////////////////////////////////////////////////////////
166
// Implementation of SMI CORBA interface MAFFinderComplement //
167
///////////////////////////////////////////////////////////////
168

169
170     public Name[] lookup_agent_names(AgentProfile profile)
171     {
172         return myFinder.lookup_names(profile);
173     }
174
175
176     public AgentProfile get_agent_profile(Name name)
177         throws AgentNotFound
178     {
179         return myFinder.getAgentProfile(new org.objectweb.mobilitools.smi.api.Name(name));
180     }
181 }
182
Popular Tags