1 /*
2  * Copyright (c) 2000, 2001, 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 
26 package org.omg.CORBA;
27 import org.omg.CORBA.portable.*;
28 
29 
30 /**
31  * <P>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<P>
53  * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
54      *      comments for unimplemented features</a>
55  */
56 
57 public class LocalObject implements org.omg.CORBA.Object
58 {
59     private static String reason = "This is a locally constrained object.";
60 
61     /**
62      * Constructs a default <code>LocalObject</code> instance.
63      */
LocalObject()64     public LocalObject() {}
65 
66     /**
67      * <P>Determines whether the two object references are equivalent,
68      * so far as the ORB can easily determine. Two object references are equivalent
69      * if they are identical. Two distinct object references which in fact refer to
70      * the same object are also equivalent. However, ORBs are not required
71      * to attempt determination of whether two distinct object references
72      * refer to the same object, since such determination could be impractically
73      * expensive.
74      * <P>Default implementation of the org.omg.CORBA.Object method. <P>
75      *
76      * @param that the object reference with which to check for equivalence
77      * @return <code>true</code> if this object reference is known to be
78      *         equivalent to the given object reference.
79      *         Note that <code>false</code> indicates only that the two
80      *         object references are distinct, not necessarily that
81      *         they reference distinct objects.
82      */
_is_equivalent(org.omg.CORBA.Object that)83     public boolean _is_equivalent(org.omg.CORBA.Object that) {
84         return equals(that) ;
85     }
86 
87     /**
88      * Always returns <code>false</code>.
89      * This method is the default implementation of the
90      * <code>org.omg.CORBA.Object</code> method.<P>
91      *
92      * @return <code>false</code>
93      */
_non_existent()94     public boolean _non_existent() {
95         return false;
96     }
97 
98     /**
99      * Returns a hash value that is consistent for the
100      * lifetime of the object, using the given number as the maximum.
101      * This method is the default implementation of the
102      * <code>org.omg.CORBA.Object</code> method.<P>
103      * @param maximum an <code>int</code> identifying maximum value of
104      *                  the hashcode
105      * @return this instance's hashcode
106      */
_hash(int maximum)107     public int _hash(int maximum) {
108         return hashCode() ;
109     }
110 
111     /**
112      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
113      * the message "This is a locally constrained object."  This method
114      * does not apply to local objects and is therefore not implemented.
115      * This method is the default implementation of the
116      * <code>org.omg.CORBA.Object</code> method.<P>
117      *
118      * @param repository_id a <code>String</code>
119      * @return NO_IMPLEMENT because this is a locally constrained object
120      *      and this method does not apply to local objects
121      * @exception NO_IMPLEMENT because this is a locally constrained object
122      *      and this method does not apply to local objects
123      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
124      *      comments for unimplemented features</a>
125      */
_is_a(String repository_id)126     public boolean _is_a(String repository_id) {
127         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
128     }
129 
130     /**
131      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
132      * the message "This is a locally constrained object."
133      * This method is the default implementation of the
134      * <code>org.omg.CORBA.Object</code> method.<P>
135      * @return a duplicate of this <code>LocalObject</code> instance.
136      * @exception NO_IMPLEMENT
137      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
138      *      comments for unimplemented features</a>
139      */
_duplicate()140     public org.omg.CORBA.Object _duplicate() {
141         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
142     }
143 
144     /**
145      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
146      * the message "This is a locally constrained object."
147      * This method is the default implementation of the
148      * <code>org.omg.CORBA.Object</code> method.<P>
149      * @exception NO_IMPLEMENT
150      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
151      *      comments for unimplemented features</a>
152      */
_release()153     public void _release() {
154         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
155     }
156 
157     /**
158      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
159      * the message "This is a locally constrained object."
160      * This method is the default implementation of the
161      * <code>org.omg.CORBA.Object</code> method.<P>
162      *
163      * @param operation a <code>String</code> giving the name of an operation
164      *        to be performed by the request that is returned
165      * @return a <code>Request</code> object with the given operation
166      * @exception NO_IMPLEMENT
167      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
168      *      comments for unimplemented features</a>
169      */
_request(String operation)170     public Request _request(String operation) {
171         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
172     }
173 
174     /**
175      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
176      * the message "This is a locally constrained object."
177      * This method is the default implementation of the
178      * <code>org.omg.CORBA.Object</code> method.<P>
179      *
180      * @param ctx          a <code>Context</code> object containing
181      *                     a list of properties
182      * @param operation    the <code>String</code> representing the name of the
183      *                     method to be invoked
184      * @param arg_list     an <code>NVList</code> containing the actual arguments
185      *                     to the method being invoked
186      * @param result       a <code>NamedValue</code> object to serve as a
187      *                     container for the method's return value
188      * @return a new <code>Request</code> object initialized with the given
189      * arguments
190      * @exception NO_IMPLEMENT
191      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
192      *      comments for unimplemented features</a>
193      */
_create_request(Context ctx, String operation, NVList arg_list, NamedValue result)194     public Request _create_request(Context ctx,
195                                    String operation,
196                                    NVList arg_list,
197                                    NamedValue result) {
198         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
199     }
200 
201     /**
202      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
203      * the message "This is a locally constrained object."
204      * This method is the default implementation of the
205      * <code>org.omg.CORBA.Object</code> method.<P>
206      *
207      * @param ctx          a <code>Context</code> object containing
208      *                     a list of properties
209      * @param operation    the name of the method to be invoked
210      * @param arg_list     an <code>NVList</code> containing the actual arguments
211      *                     to the method being invoked
212      * @param result       a <code>NamedValue</code> object to serve as a
213      *                     container for the method's return value
214      * @param exceptions   an <code>ExceptionList</code> object containing a
215      *                     list of possible exceptions the method can throw
216      * @param contexts     a <code>ContextList</code> object containing a list of
217      *                     context strings that need to be resolved and sent
218      *                     with the
219      *                     <code>Request</code> instance
220      * @return the new <code>Request</code> object initialized with the given
221      * arguments
222      * @exception NO_IMPLEMENT
223      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
224      *      comments for unimplemented features</a>
225      */
_create_request(Context ctx, String operation, NVList arg_list, NamedValue result, ExceptionList exceptions, ContextList contexts)226     public Request _create_request(Context ctx,
227                                    String operation,
228                                    NVList arg_list,
229                                    NamedValue result,
230                                    ExceptionList exceptions,
231                                    ContextList contexts) {
232         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
233     }
234 
235     /**
236      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
237      * the message "This is a locally constrained object." This method
238      * does not apply to local objects and is therefore not implemented.
239      * This method is the default implementation of the
240      * <code>org.omg.CORBA.Object</code> method.<P>
241      * @return NO_IMPLEMENT because this is a locally constrained object
242      *      and this method does not apply to local objects
243      * @exception NO_IMPLEMENT because this is a locally constrained object
244      *      and this method does not apply to local objects
245      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
246      *      comments for unimplemented features</a>
247      */
_get_interface()248     public org.omg.CORBA.Object _get_interface()
249     {
250         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
251     }
252 
253     /**
254      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
255      * the message "This is a locally constrained object."
256      * This method is the default implementation of the
257      * <code>org.omg.CORBA.Object</code> method.<P>
258      * @exception NO_IMPLEMENT
259      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
260      *      comments for unimplemented features</a>
261      */
_get_interface_def()262     public org.omg.CORBA.Object _get_interface_def()
263     {
264         // First try to call the delegate implementation class's
265         // "Object get_interface_def(..)" method (will work for JDK1.2
266         // ORBs).
267         // Else call the delegate implementation class's
268         // "InterfaceDef get_interface(..)" method using reflection
269         // (will work for pre-JDK1.2 ORBs).
270 
271         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
272     }
273 
274     /**
275      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
276      * the message "This is a locally constrained object."
277      * This method is the default implementation of the
278      * <code>org.omg.CORBA.Object</code> method.<P>
279      * @return the ORB instance that created the Delegate contained in this
280      * <code>ObjectImpl</code>
281      * @exception NO_IMPLEMENT
282      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
283      *      comments for unimplemented features</a>
284      */
_orb()285     public org.omg.CORBA.ORB _orb() {
286         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
287     }
288 
289     /**
290      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
291      * the message "This is a locally constrained object." This method
292      * does not apply to local objects and is therefore not implemented.
293      * This method is the default implementation of the
294      * <code>org.omg.CORBA.Object</code> method.<P>
295      * @param policy_type  an <code>int</code>
296      * @return NO_IMPLEMENT because this is a locally constrained object
297      *      and this method does not apply to local objects
298      * @exception NO_IMPLEMENT because this is a locally constrained object
299      *      and this method does not apply to local objects
300      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
301      *      comments for unimplemented features</a>
302      */
_get_policy(int policy_type)303     public org.omg.CORBA.Policy _get_policy(int policy_type) {
304         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
305     }
306 
307 
308     /**
309      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
310      * the message "This is a locally constrained object." This method
311      * does not apply to local objects and is therefore not implemented.
312      * This method is the default implementation of the
313      * <code>org.omg.CORBA.Object</code> method.<P>
314      * @exception NO_IMPLEMENT
315      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
316      *      comments for unimplemented features</a>
317      */
_get_domain_managers()318     public org.omg.CORBA.DomainManager[] _get_domain_managers() {
319         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
320     }
321 
322     /**
323      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
324      * the message "This is a locally constrained object." This method
325      * does not apply to local objects and is therefore not implemented.
326      * This method is the default implementation of the
327      * <code>org.omg.CORBA.Object</code> method.
328      *
329      * @param policies an array
330      * @param set_add a flag
331      * @return NO_IMPLEMENT because this is a locally constrained object
332      *      and this method does not apply to local objects
333      * @exception NO_IMPLEMENT because this is a locally constrained object
334      *      and this method does not apply to local objects
335      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
336      *      comments for unimplemented features</a>
337      */
338     public org.omg.CORBA.Object
_set_policy_override(org.omg.CORBA.Policy[] policies, org.omg.CORBA.SetOverrideType set_add)339         _set_policy_override(org.omg.CORBA.Policy[] policies,
340                              org.omg.CORBA.SetOverrideType set_add) {
341         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
342     }
343 
344 
345     /**
346      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
347      * the message "This is a locally constrained object."
348      * This method is the default implementation of the
349      * <code>org.omg.CORBA.Object</code> method.<P>
350      * Returns <code>true</code> for this <code>LocalObject</code> instance.<P>
351      * @return <code>true</code> always
352      * @exception NO_IMPLEMENT
353      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
354      *      comments for unimplemented features</a>
355      */
_is_local()356     public boolean _is_local() {
357         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
358     }
359 
360     /**
361      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
362      * the message "This is a locally constrained object."
363      * This method is the default implementation of the
364      * <code>org.omg.CORBA.Object</code> method.<P>
365      * @param operation a <code>String</code> indicating which operation
366      *                  to preinvoke
367      * @param expectedType the class of the type of operation mentioned above
368      * @return NO_IMPLEMENT because this is a locally constrained object
369      *      and this method does not apply to local objects
370      * @exception NO_IMPLEMENT because this is a locally constrained object
371      *      and this method does not apply to local object
372      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
373      *      comments for unimplemented features</a>
374      */
_servant_preinvoke(String operation, Class expectedType)375     public ServantObject _servant_preinvoke(String operation,
376                                             Class expectedType) {
377         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
378     }
379 
380     /**
381      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
382      * the message "This is a locally constrained object."
383      * This method is the default implementation of the
384      * <code>org.omg.CORBA.Object</code> method.<P>
385      * @param servant the servant object on which to post-invoke
386      * @exception NO_IMPLEMENT
387      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
388      *      comments for unimplemented features</a>
389      */
_servant_postinvoke(ServantObject servant)390     public void _servant_postinvoke(ServantObject servant) {
391         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
392     }
393 
394     /*
395      * The following methods were added by orbos/98-04-03: Java to IDL
396      * Mapping. These are used by RMI over IIOP.
397      */
398 
399     /**
400      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
401      * the message "This is a locally constrained object."
402      * This method is the default implementation of the
403      * <code>org.omg.CORBA.Object</code> method.
404      * <P>Called by a stub to obtain an OutputStream for
405      * marshaling arguments. The stub must supply the operation name,
406      * and indicate if a response is expected (i.e is this a oneway
407      * call).<P>
408      * @param operation the name of the operation being requested
409      * @param responseExpected <code>true</code> if a response is expected,
410      *                         <code>false</code> if it is a one-way call
411      * @return NO_IMPLEMENT because this is a locally constrained object
412      *      and this method does not apply to local objects
413      * @exception NO_IMPLEMENT because this is a locally constrained object
414      *      and this method does not apply to local objects
415      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
416      *      comments for unimplemented features</a>
417      */
_request(String operation, boolean responseExpected)418     public OutputStream _request(String operation,
419                                  boolean responseExpected) {
420         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
421     }
422 
423     /**
424      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
425      * the message "This is a locally constrained object."
426      * This method is the default implementation of the
427      * <code>org.omg.CORBA.Object</code> method.
428      * <P>Called to invoke an operation. The stub provides an
429      * <code>OutputStream</code> that was previously returned by a
430      * <code>_request()</code>
431      * call. <code>_invoke</code> returns an <code>InputStream</code> which
432      * contains the
433      * marshaled reply. If an exception occurs, <code>_invoke</code> may throw an
434      * <code>ApplicationException</code> object which contains an
435      * <code>InputStream</code> from
436      * which the user exception state may be unmarshaled.<P>
437      * @param output the <code>OutputStream</code> to invoke
438      * @return NO_IMPLEMENT because this is a locally constrained object
439      *      and this method does not apply to local objects
440      * @throws ApplicationException If an exception occurs,
441      * <code>_invoke</code> may throw an
442      * <code>ApplicationException</code> object which contains
443      * an <code>InputStream</code> from
444      * which the user exception state may be unmarshaled.
445      * @throws RemarshalException If an exception occurs,
446      * <code>_invoke</code> may throw an
447      * <code>ApplicationException</code> object which contains
448      * an <code>InputStream</code> from
449      * which the user exception state may be unmarshaled.
450      * @exception NO_IMPLEMENT because this is a locally constrained object
451      *      and this method does not apply to local objects
452      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
453      *      comments for unimplemented features</a>
454      */
_invoke(OutputStream output)455     public InputStream _invoke(OutputStream output)
456         throws ApplicationException, RemarshalException
457     {
458         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
459     }
460 
461     /**
462      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
463      * the message "This is a locally constrained object."
464      * This method is the default implementation of the
465      * <code>org.omg.CORBA.Object</code> method.
466      * <P>May optionally be called by a stub to release a
467      * reply stream back to the ORB when the unmarshaling has
468      * completed. The stub passes the <code>InputStream</code> returned by
469      * <code>_invoke()</code> or
470      * <code>ApplicationException.getInputStream()</code>.
471      * A null
472      * value may also be passed to <code>_releaseReply</code>, in which case the
473      * method is a no-op.<P>
474      * @param input the reply stream back to the ORB or null
475      * @exception NO_IMPLEMENT
476      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
477      *      comments for unimplemented features</a>
478      */
_releaseReply(InputStream input)479     public void _releaseReply(InputStream input) {
480         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
481     }
482 
483     /**
484      * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
485      * the message "This is a locally constrained object." This method
486      * does not apply to local objects and is therefore not implemented.
487      * This method is the default implementation of the
488      * <code>org.omg.CORBA.Object</code> method.<P>
489      * @return NO_IMPLEMENT because this is a locally constrained object
490      *      and this method does not apply to local objects
491      * @exception NO_IMPLEMENT because this is a locally constrained object
492      *      and this method does not apply to local objects
493      * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
494      *      comments for unimplemented features</a>
495      */
496 
validate_connection()497     public boolean validate_connection() {
498         throw new org.omg.CORBA.NO_IMPLEMENT(reason);
499     }
500 }
501