OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [classpath/] [gnu/] [CORBA/] [NamingService/] [Ext.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* TransientContextExt.java --
2
   Copyright (C) 2005 Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
 
39
package gnu.CORBA.NamingService;
40
 
41
import org.omg.CORBA.NO_IMPLEMENT;
42
import org.omg.CORBA.Object;
43
import org.omg.CORBA.portable.Delegate;
44
import org.omg.CORBA.portable.ObjectImpl;
45
import org.omg.CosNaming.BindingIteratorHolder;
46
import org.omg.CosNaming.BindingListHolder;
47
import org.omg.CosNaming.NameComponent;
48
import org.omg.CosNaming.NamingContext;
49
import org.omg.CosNaming.NamingContextPackage.AlreadyBound;
50
import org.omg.CosNaming.NamingContextPackage.CannotProceed;
51
import org.omg.CosNaming.NamingContextPackage.InvalidName;
52
import org.omg.CosNaming.NamingContextPackage.NotEmpty;
53
import org.omg.CosNaming.NamingContextPackage.NotFound;
54
import org.omg.CosNaming._NamingContextExtImplBase;
55
 
56
/**
57
 * This naming context that adds the the string based extensions,
58
 * defined by {@link NamingContextExt}. The basic functionality
59
 * is handled by the enclosed instance of the {@link NamingContext}.
60
 *
61
 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
62
 */
63
public class Ext
64
  extends _NamingContextExtImplBase
65
{
66
  /**
67
   * The older version of the naming context, where all relevant calls
68
   * are forwarded.
69
   */
70
  private final NamingContext classic;
71
 
72
  /**
73
   * The converter class converts between string and array form of the
74
   * name.
75
   */
76
  private NameTransformer converter = new NameTransformer();
77
 
78
  /**
79
   * Create the extensions for the given instance of the context.
80
   *
81
   * @param previous_version the previous version of the naming context.
82
   */
83
  public Ext(NamingContext previous_version)
84
  {
85
    classic = previous_version;
86
  }
87
 
88
  /**
89
   * Sets a delegate to this context and, if appropriated, also
90
   * sets the same delegate to the enclosing 'classic' context.
91
   *
92
   * @param a_delegate a delegate to set.
93
   */
94
  public void _set_delegate(Delegate a_delegate)
95
  {
96
    super._set_delegate(a_delegate);
97
    if (classic instanceof ObjectImpl)
98
      ((ObjectImpl) classic)._set_delegate(a_delegate);
99
  }
100
 
101
  /** {@inheritDoc} */
102
  public void bind(NameComponent[] a_name, Object an_object)
103
            throws NotFound, CannotProceed, InvalidName, AlreadyBound
104
  {
105
    classic.bind(a_name, an_object);
106
  }
107
 
108
  /** {@inheritDoc} */
109
  public void bind_context(NameComponent[] a_name, NamingContext context)
110
                    throws NotFound, CannotProceed, InvalidName, AlreadyBound
111
  {
112
    classic.bind_context(a_name, context);
113
  }
114
 
115
  /** {@inheritDoc} */
116
  public NamingContext bind_new_context(NameComponent[] a_name)
117
                                 throws NotFound, AlreadyBound, CannotProceed,
118
                                        InvalidName
119
  {
120
    return classic.bind_new_context(a_name);
121
  }
122
 
123
  /** {@inheritDoc} */
124
  public void destroy()
125
               throws NotEmpty
126
  {
127
    classic.destroy();
128
  }
129
 
130
  /** {@inheritDoc} */
131
  public void list(int amount, BindingListHolder a_list,
132
                   BindingIteratorHolder an_iter
133
                  )
134
  {
135
    classic.list(amount, a_list, an_iter);
136
  }
137
 
138
  /** {@inheritDoc} */
139
  public NamingContext new_context()
140
  {
141
    return classic.new_context();
142
  }
143
 
144
  /** {@inheritDoc} */
145
  public void rebind(NameComponent[] a_name, Object an_object)
146
              throws NotFound, CannotProceed, InvalidName
147
  {
148
    classic.rebind(a_name, an_object);
149
  }
150
 
151
  /** {@inheritDoc} */
152
  public void rebind_context(NameComponent[] a_name, NamingContext context)
153
                      throws NotFound, CannotProceed, InvalidName
154
  {
155
    classic.rebind_context(a_name, context);
156
  }
157
 
158
  /** {@inheritDoc} */
159
  public Object resolve(NameComponent[] a_name)
160
                 throws NotFound, CannotProceed, InvalidName
161
  {
162
    return classic.resolve(a_name);
163
  }
164
 
165
  /**
166
   * Resolves the name, represented in the form of the string. The name
167
   * is first parsed into an array representation, then the call
168
   * is forwarded to the {@link resolve(NameComponent[])}.
169
   *
170
   * @param a_name_string a name to resolve.
171
   *
172
   * @return the resolved object.
173
   *
174
   * @throws NotFound if the name cannot be resolved.
175
   * @throws InvalidName if the name is invalid.
176
   * @throws CannotProceed on unexpected circumstances.
177
   */
178
  public Object resolve_str(String a_name_string)
179
                     throws NotFound, CannotProceed, InvalidName
180
  {
181
    return resolve(to_name(a_name_string));
182
  }
183
 
184
  /**
185
   * Convert the name string representation into array representation.
186
   *
187
   * @param a_name_string a string to convert.
188
   * @return a converted array of the name components
189
   *
190
   * @throws InvalidName on parsing error.
191
   */
192
  public NameComponent[] to_name(String a_name_string)
193
                          throws InvalidName
194
  {
195
    return converter.toName(a_name_string);
196
  }
197
 
198
  /**
199
   * Convert a name component array representation into string representation.
200
   *
201
   * @param a_name a name to convert.
202
   *
203
   * @return a string form.
204
   *
205
   * @throws InvalidName if the passed name is invalid.
206
   */
207
  public String to_string(NameComponent[] a_name)
208
                   throws InvalidName
209
  {
210
    return converter.toString(a_name);
211
  }
212
 
213
  /**
214
   * This method is not yet implemented.
215
   * FIXME TODO implement it.
216
   */
217
  public String to_url(String an_address, String a_name_string)
218
                throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
219
                       InvalidName
220
  {
221
    throw new NO_IMPLEMENT("Method to_url() not yet implemented.");
222
  }
223
 
224
  /** {@inheritDoc} */
225
  public void unbind(NameComponent[] a_name)
226
              throws NotFound, CannotProceed, InvalidName
227
  {
228
    classic.unbind(a_name);
229
  }
230
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.