LocalObject.java revision 673:6b017d166ac2
1/*
2 * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package org.omg.CORBA;
27import org.omg.CORBA.portable.*;
28
29
30/**
31 * Used as a base class for implementation of a local IDL interface in the
32 * Java language mapping.  It is a class which implements all the operations
33 * in the <tt>org.omg.CORBA.Object</tt> interface.
34 * <P>Local interfaces are implemented by using CORBA::LocalObject
35 *  to provide implementations of <code>Object</code> pseudo
36 *  operations and any other ORB-specific support mechanisms that are
37 *  appropriate for such objects.  Object implementation techniques are
38 *  inherently language-mapping specific.  Therefore, the
39 *  <code>LocalObject</code> type is not defined in IDL, but is specified
40 *  in each language mapping.
41 *  <P>Methods that do not apply to local objects throw
42 *  an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with the message,
43 *  "This is a locally contrained object."  Attempting to use a
44 *  <TT>LocalObject</TT> to create a DII request results in NO_IMPLEMENT
45 *  system exception.  Attempting to marshal or stringify a
46 *  <TT>LocalObject</TT> results in a MARSHAL system exception.  Narrowing
47 *  and widening references to <TT>LocalObjects</TT> must work as for regular
48 *  object references.
49 *  <P><code>LocalObject</code> is to be used as the base class of locally
50 *  constrained objects, such as those in the PortableServer module.
51 *  The specification here is based on the CORBA Components
52 *  Volume I - orbos/99-07-01
53 *
54 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
55 *      comments for unimplemented features</a>
56 */
57
58public class LocalObject implements org.omg.CORBA.Object
59{
60    private static String reason = "This is a locally constrained object.";
61
62    /**
63     * Constructs a default <code>LocalObject</code> instance.
64     */
65    public LocalObject() {}
66
67    /**
68     * Determines whether the two object references are equivalent,
69     * so far as the ORB can easily determine. Two object references are equivalent
70     * if they are identical. Two distinct object references which in fact refer to
71     * the same object are also equivalent. However, ORBs are not required
72     * to attempt determination of whether two distinct object references
73     * refer to the same object, since such determination could be impractically
74     * expensive.
75     * <P>Default implementation of the org.omg.CORBA.Object method.
76     *
77     * @param that the object reference with which to check for equivalence
78     * @return <code>true</code> if this object reference is known to be
79     *         equivalent to the given object reference.
80     *         Note that <code>false</code> indicates only that the two
81     *         object references are distinct, not necessarily that
82     *         they reference distinct objects.
83     */
84    public boolean _is_equivalent(org.omg.CORBA.Object that) {
85        return equals(that) ;
86    }
87
88    /**
89     * Always returns <code>false</code>.
90     * This method is the default implementation of the
91     * <code>org.omg.CORBA.Object</code> method.
92     *
93     * @return <code>false</code>
94     */
95    public boolean _non_existent() {
96        return false;
97    }
98
99    /**
100     * Returns a hash value that is consistent for the
101     * lifetime of the object, using the given number as the maximum.
102     * This method is the default implementation of the
103     * <code>org.omg.CORBA.Object</code> method.
104     *
105     * @param maximum an <code>int</code> identifying maximum value of
106     *                the hashcode
107     * @return this instance's hashcode
108     */
109    public int _hash(int maximum) {
110        return hashCode() ;
111    }
112
113    /**
114     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
115     * the message "This is a locally constrained object."  This method
116     * does not apply to local objects and is therefore not implemented.
117     * This method is the default implementation of the
118     * <code>org.omg.CORBA.Object</code> method.
119     *
120     * @param repository_id a <code>String</code>
121     * @return NO_IMPLEMENT because this is a locally constrained object
122     *      and this method does not apply to local objects
123     * @exception NO_IMPLEMENT because this is a locally constrained object
124     *      and this method does not apply to local objects
125     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
126     *      comments for unimplemented features</a>
127     */
128    public boolean _is_a(String repository_id) {
129        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
130    }
131
132    /**
133     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
134     * the message "This is a locally constrained object."
135     * This method is the default implementation of the
136     * <code>org.omg.CORBA.Object</code> method.
137     *
138     * @return a duplicate of this <code>LocalObject</code> instance.
139     * @exception NO_IMPLEMENT
140     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
141     *      comments for unimplemented features</a>
142     */
143    public org.omg.CORBA.Object _duplicate() {
144        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
145    }
146
147    /**
148     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
149     * the message "This is a locally constrained object."
150     * This method is the default implementation of the
151     * <code>org.omg.CORBA.Object</code> method.
152     *
153     * @exception NO_IMPLEMENT
154     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
155     *      comments for unimplemented features</a>
156     */
157    public void _release() {
158        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
159    }
160
161    /**
162     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
163     * the message "This is a locally constrained object."
164     * This method is the default implementation of the
165     * <code>org.omg.CORBA.Object</code> method.
166     *
167     * @param operation a <code>String</code> giving the name of an operation
168     *        to be performed by the request that is returned
169     * @return a <code>Request</code> object with the given operation
170     * @exception NO_IMPLEMENT
171     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
172     *      comments for unimplemented features</a>
173     */
174    public Request _request(String operation) {
175        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
176    }
177
178    /**
179     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
180     * the message "This is a locally constrained object."
181     * This method is the default implementation of the
182     * <code>org.omg.CORBA.Object</code> method.
183     *
184     * @param ctx          a <code>Context</code> object containing
185     *                     a list of properties
186     * @param operation    the <code>String</code> representing the name of the
187     *                     method to be invoked
188     * @param arg_list     an <code>NVList</code> containing the actual arguments
189     *                     to the method being invoked
190     * @param result       a <code>NamedValue</code> object to serve as a
191     *                     container for the method's return value
192     * @return a new <code>Request</code> object initialized with the given
193     * arguments
194     * @exception NO_IMPLEMENT
195     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
196     *      comments for unimplemented features</a>
197     */
198    public Request _create_request(Context ctx,
199                                   String operation,
200                                   NVList arg_list,
201                                   NamedValue result) {
202        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
203    }
204
205    /**
206     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
207     * the message "This is a locally constrained object."
208     * This method is the default implementation of the
209     * <code>org.omg.CORBA.Object</code> method.
210     *
211     * @param ctx          a <code>Context</code> object containing
212     *                     a list of properties
213     * @param operation    the name of the method to be invoked
214     * @param arg_list     an <code>NVList</code> containing the actual arguments
215     *                     to the method being invoked
216     * @param result       a <code>NamedValue</code> object to serve as a
217     *                     container for the method's return value
218     * @param exceptions   an <code>ExceptionList</code> object containing a
219     *                     list of possible exceptions the method can throw
220     * @param contexts     a <code>ContextList</code> object containing a list of
221     *                     context strings that need to be resolved and sent
222     *                     with the
223     *                     <code>Request</code> instance
224     * @return the new <code>Request</code> object initialized with the given
225     * arguments
226     * @exception NO_IMPLEMENT
227     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
228     *      comments for unimplemented features</a>
229     */
230    public Request _create_request(Context ctx,
231                                   String operation,
232                                   NVList arg_list,
233                                   NamedValue result,
234                                   ExceptionList exceptions,
235                                   ContextList contexts) {
236        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
237    }
238
239    /**
240     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
241     * the message "This is a locally constrained object." This method
242     * does not apply to local objects and is therefore not implemented.
243     * This method is the default implementation of the
244     * <code>org.omg.CORBA.Object</code> method.
245     *
246     * @return NO_IMPLEMENT because this is a locally constrained object
247     *      and this method does not apply to local objects
248     * @exception NO_IMPLEMENT because this is a locally constrained object
249     *      and this method does not apply to local objects
250     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
251     *      comments for unimplemented features</a>
252     */
253    public org.omg.CORBA.Object _get_interface()
254    {
255        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
256    }
257
258    /**
259     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
260     * the message "This is a locally constrained object."
261     * This method is the default implementation of the
262     * <code>org.omg.CORBA.Object</code> method.
263     *
264     * @exception NO_IMPLEMENT
265     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
266     *      comments for unimplemented features</a>
267     */
268    public org.omg.CORBA.Object _get_interface_def()
269    {
270        // First try to call the delegate implementation class's
271        // "Object get_interface_def(..)" method (will work for JDK1.2
272        // ORBs).
273        // Else call the delegate implementation class's
274        // "InterfaceDef get_interface(..)" method using reflection
275        // (will work for pre-JDK1.2 ORBs).
276
277        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
278    }
279
280    /**
281     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
282     * the message "This is a locally constrained object."
283     * This method is the default implementation of the
284     * <code>org.omg.CORBA.Object</code> method.
285     * @return the ORB instance that created the Delegate contained in this
286     * <code>ObjectImpl</code>
287     * @exception NO_IMPLEMENT
288     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
289     *      comments for unimplemented features</a>
290     */
291    public org.omg.CORBA.ORB _orb() {
292        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
293    }
294
295    /**
296     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
297     * the message "This is a locally constrained object." This method
298     * does not apply to local objects and is therefore not implemented.
299     * This method is the default implementation of the
300     * <code>org.omg.CORBA.Object</code> method.
301     *
302     * @param policy_type  an <code>int</code>
303     * @return NO_IMPLEMENT because this is a locally constrained object
304     *      and this method does not apply to local objects
305     * @exception NO_IMPLEMENT because this is a locally constrained object
306     *      and this method does not apply to local objects
307     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
308     *      comments for unimplemented features</a>
309     */
310    public org.omg.CORBA.Policy _get_policy(int policy_type) {
311        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
312    }
313
314
315    /**
316     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
317     * the message "This is a locally constrained object." This method
318     * does not apply to local objects and is therefore not implemented.
319     * This method is the default implementation of the
320     * <code>org.omg.CORBA.Object</code> method.
321     *
322     * @exception NO_IMPLEMENT
323     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
324     *      comments for unimplemented features</a>
325     */
326    public org.omg.CORBA.DomainManager[] _get_domain_managers() {
327        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
328    }
329
330    /**
331     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
332     * the message "This is a locally constrained object." This method
333     * does not apply to local objects and is therefore not implemented.
334     * This method is the default implementation of the
335     * <code>org.omg.CORBA.Object</code> method.
336     *
337     * @param policies an array
338     * @param set_add a flag
339     * @return NO_IMPLEMENT because this is a locally constrained object
340     *      and this method does not apply to local objects
341     * @exception NO_IMPLEMENT because this is a locally constrained object
342     *      and this method does not apply to local objects
343     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
344     *      comments for unimplemented features</a>
345     */
346    public org.omg.CORBA.Object
347        _set_policy_override(org.omg.CORBA.Policy[] policies,
348                             org.omg.CORBA.SetOverrideType set_add) {
349        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
350    }
351
352
353    /**
354     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
355     * the message "This is a locally constrained object."
356     * This method is the default implementation of the
357     * <code>org.omg.CORBA.Object</code> method.<P>
358     * Returns <code>true</code> for this <code>LocalObject</code> instance.
359     *
360     * @return <code>true</code> always
361     * @exception NO_IMPLEMENT
362     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
363     *      comments for unimplemented features</a>
364     */
365    public boolean _is_local() {
366        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
367    }
368
369    /**
370     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
371     * the message "This is a locally constrained object."
372     * This method is the default implementation of the
373     * <code>org.omg.CORBA.Object</code> method.
374     *
375     * @param operation a <code>String</code> indicating which operation
376     *                  to preinvoke
377     * @param expectedType the class of the type of operation mentioned above
378     * @return NO_IMPLEMENT because this is a locally constrained object
379     *      and this method does not apply to local objects
380     * @exception NO_IMPLEMENT because this is a locally constrained object
381     *      and this method does not apply to local object
382     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
383     *      comments for unimplemented features</a>
384     */
385    public ServantObject _servant_preinvoke(String operation,
386                                            Class expectedType) {
387        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
388    }
389
390    /**
391     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
392     * the message "This is a locally constrained object."
393     * This method is the default implementation of the
394     * <code>org.omg.CORBA.Object</code> method.
395     *
396     * @param servant the servant object on which to post-invoke
397     * @exception NO_IMPLEMENT
398     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
399     *      comments for unimplemented features</a>
400     */
401    public void _servant_postinvoke(ServantObject servant) {
402        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
403    }
404
405    /*
406     * The following methods were added by orbos/98-04-03: Java to IDL
407     * Mapping. These are used by RMI over IIOP.
408     */
409
410    /**
411     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
412     * the message "This is a locally constrained object."
413     * This method is the default implementation of the
414     * <code>org.omg.CORBA.Object</code> method.
415     * <P>Called by a stub to obtain an OutputStream for
416     * marshaling arguments. The stub must supply the operation name,
417     * and indicate if a response is expected (i.e is this a oneway call).
418     *
419     * @param operation the name of the operation being requested
420     * @param responseExpected <code>true</code> if a response is expected,
421     *                         <code>false</code> if it is a one-way call
422     * @return NO_IMPLEMENT because this is a locally constrained object
423     *      and this method does not apply to local objects
424     * @exception NO_IMPLEMENT because this is a locally constrained object
425     *      and this method does not apply to local objects
426     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
427     *      comments for unimplemented features</a>
428     */
429    public OutputStream _request(String operation,
430                                 boolean responseExpected) {
431        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
432    }
433
434    /**
435     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
436     * the message "This is a locally constrained object."
437     * This method is the default implementation of the
438     * <code>org.omg.CORBA.Object</code> method.
439     * <P>Called to invoke an operation. The stub provides an
440     * <code>OutputStream</code> that was previously returned by a
441     * <code>_request()</code>
442     * call. <code>_invoke</code> returns an <code>InputStream</code> which
443     * contains the
444     * marshaled reply. If an exception occurs, <code>_invoke</code> may throw an
445     * <code>ApplicationException</code> object which contains an
446     * <code>InputStream</code> from
447     * which the user exception state may be unmarshaled.
448     *
449     * @param output the <code>OutputStream</code> to invoke
450     * @return NO_IMPLEMENT because this is a locally constrained object
451     *      and this method does not apply to local objects
452     * @throws ApplicationException If an exception occurs,
453     * <code>_invoke</code> may throw an
454     * <code>ApplicationException</code> object which contains
455     * an <code>InputStream</code> from
456     * which the user exception state may be unmarshaled.
457     * @throws RemarshalException If an exception occurs,
458     * <code>_invoke</code> may throw an
459     * <code>ApplicationException</code> object which contains
460     * an <code>InputStream</code> from
461     * which the user exception state may be unmarshaled.
462     * @exception NO_IMPLEMENT because this is a locally constrained object
463     *      and this method does not apply to local objects
464     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
465     *      comments for unimplemented features</a>
466     */
467    public InputStream _invoke(OutputStream output)
468        throws ApplicationException, RemarshalException
469    {
470        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
471    }
472
473    /**
474     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
475     * the message "This is a locally constrained object."
476     * This method is the default implementation of the
477     * <code>org.omg.CORBA.Object</code> method.
478     * <P>May optionally be called by a stub to release a
479     * reply stream back to the ORB when the unmarshaling has
480     * completed. The stub passes the <code>InputStream</code> returned by
481     * <code>_invoke()</code> or
482     * <code>ApplicationException.getInputStream()</code>.
483     * A null
484     * value may also be passed to <code>_releaseReply</code>, in which case the
485     * method is a no-op.
486     *
487     * @param input the reply stream back to the ORB or null
488     * @exception NO_IMPLEMENT
489     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
490     *      comments for unimplemented features</a>
491     */
492    public void _releaseReply(InputStream input) {
493        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
494    }
495
496    /**
497     * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
498     * the message "This is a locally constrained object." This method
499     * does not apply to local objects and is therefore not implemented.
500     * This method is the default implementation of the
501     * <code>org.omg.CORBA.Object</code> method.
502     *
503     * @return NO_IMPLEMENT because this is a locally constrained object
504     *      and this method does not apply to local objects
505     * @exception NO_IMPLEMENT because this is a locally constrained object
506     *      and this method does not apply to local objects
507     * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
508     *      comments for unimplemented features</a>
509     */
510
511    public boolean validate_connection() {
512        throw new org.omg.CORBA.NO_IMPLEMENT(reason);
513    }
514}
515