Source Code Cross Referenced for ObjectImpl.java in  » 6.0-JDK-Modules-sun » omg » org » omg » CORBA » portable » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules sun » omg » org.omg.CORBA.portable 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:        package org.omg.CORBA.portable;
026:
027:        import org.omg.CORBA.Request;
028:        import org.omg.CORBA.NamedValue;
029:        import org.omg.CORBA.NVList;
030:        import org.omg.CORBA.ExceptionList;
031:        import org.omg.CORBA.ContextList;
032:        import org.omg.CORBA.Context;
033:        import org.omg.CORBA.TypeCode;
034:        import org.omg.CORBA.BAD_OPERATION;
035:        import org.omg.CORBA.SystemException;
036:
037:        /**
038:         *  The common base class for all stub classes; provides default implementations
039:         *  of the <code>org.omg.CORBA.Object</code> methods. All method implementations are 
040:         *  forwarded to a <code>Delegate</code> object stored in the <code>ObjectImpl</code>
041:         *  instance.  <code>ObjectImpl</code> allows for portable stubs because the 
042:         *  <code>Delegate</code> can be implemented by a different vendor-specific ORB.
043:         */
044:
045:        abstract public class ObjectImpl implements  org.omg.CORBA.Object {
046:
047:            /**
048:             * The field that stores the <code>Delegate</code> instance for 
049:             * this <code>ObjectImpl</code> object. This <code>Delegate</code>
050:             * instance can be implemented by a vendor-specific ORB.  Stub classes,
051:             * which are derived from this <code>ObjectImpl</code> class, can be
052:             * portable because they delegate all of the methods called on them to this
053:             * <code>Delegate</code> object.
054:             */
055:            private transient Delegate __delegate;
056:
057:            /**
058:             * Retrieves the reference to the vendor-specific <code>Delegate</code> 
059:             * object to which this <code>ObjectImpl</code> object delegates all 
060:             * methods invoked on it.
061:             *
062:             * @return the Delegate contained in this ObjectImpl instance 
063:             * @throws BAD_OPERATION if the delegate has not been set
064:             * @see #_set_delegate
065:             */
066:            public Delegate _get_delegate() {
067:                if (__delegate == null)
068:                    throw new BAD_OPERATION("The delegate has not been set!");
069:                return __delegate;
070:            }
071:
072:            /** 
073:             * Sets the Delegate for this <code>ObjectImpl</code> instance to the given
074:             * <code>Delegate</code> object.  All method invocations on this 
075:             * <code>ObjectImpl</code> object will be forwarded to this delegate.
076:             *
077:             * @param delegate the <code>Delegate</code> instance to which
078:             *        all method calls on this <code>ObjectImpl</code> object
079:             *        will be delegated; may be implemented by a third-party ORB
080:             * @see #_get_delegate
081:             */
082:            public void _set_delegate(Delegate delegate) {
083:                __delegate = delegate;
084:            }
085:
086:            /** 
087:             * Retrieves a string array containing the repository identifiers
088:             * supported by this <code>ObjectImpl</code> object.  For example,
089:             * for a stub, this method returns information about all the
090:             * interfaces supported by the stub.
091:             *
092:             * @return the array of all repository identifiers supported by this
093:             *         <code>ObjectImpl</code> instance
094:             */
095:            public abstract String[] _ids();
096:
097:            /**            
098:             * Returns a duplicate of this <code>ObjectImpl</code> object.
099:             *
100:             * @return an <code>orb.omg.CORBA.Object</code> object that is
101:             *         a duplicate of this object
102:             */
103:            public org.omg.CORBA.Object _duplicate() {
104:                return _get_delegate().duplicate(this );
105:            }
106:
107:            /**            
108:             * Releases the resources associated with this <code>ObjectImpl</code> object.
109:             */
110:            public void _release() {
111:                _get_delegate().release(this );
112:            }
113:
114:            /**            
115:             * Checks whether the object identified by the given repository 
116:             * identifier is an <code>ObjectImpl</code> object.
117:             *
118:             * @param repository_id a <code>String</code> object with the repository
119:             *        identifier to check
120:             * @return <code>true</code> if the object identified by the given
121:             *         repository id is an instance of <code>ObjectImpl</code>;
122:             *         <code>false</code> otherwise
123:             */
124:            public boolean _is_a(String repository_id) {
125:                return _get_delegate().is_a(this , repository_id);
126:            }
127:
128:            /**            
129:             * Checks whether the the given <code>ObjectImpl</code> object is
130:             * equivalent to this <code>ObjectImpl</code> object.
131:             *
132:             * @param that an instance of <code>ObjectImpl</code> to compare with
133:             *        this <code>ObjectImpl</code> object
134:             * @return <code>true</code> if the given object is equivalent
135:             *         to this <code>ObjectImpl</code> object;
136:             *         <code>false</code> otherwise
137:             */
138:            public boolean _is_equivalent(org.omg.CORBA.Object that) {
139:                return _get_delegate().is_equivalent(this , that);
140:            }
141:
142:            /** 
143:             * Checks whether the server object for this <code>ObjectImpl</code> 
144:             * object has been destroyed.
145:             * 
146:             * @return <code>true</code> if the ORB knows authoritatively that the
147:             *         server object does not exist; <code>false</code> otherwise
148:             */
149:            public boolean _non_existent() {
150:                return _get_delegate().non_existent(this );
151:            }
152:
153:            /** 
154:             * Retrieves the hash code that serves as an ORB-internal identifier for 
155:             * this <code>ObjectImpl</code> object.
156:             *
157:             * @param maximum an <code>int</code> indicating the upper bound on the hash 
158:             *        value returned by the ORB
159:             * @return an <code>int</code> representing the hash code for this
160:             *         <code>ObjectImpl</code> object
161:             */
162:            public int _hash(int maximum) {
163:                return _get_delegate().hash(this , maximum);
164:            }
165:
166:            /**
167:             * Creates a <code>Request</code> object containing the given method
168:             * that can be used with the Dynamic Invocation Interface.
169:             *
170:             * @param operation the method to be invoked by the new <code>Request</code>
171:             *        object
172:             * @return a new <code>Request</code> object initialized with the
173:             *         given method
174:             */
175:            public Request _request(String operation) {
176:                return _get_delegate().request(this , operation);
177:            }
178:
179:            /**
180:             * Creates a <code>Request</code> object that contains the given context,
181:             * method, argument list, and container for the result.
182:             *
183:             * @param ctx the Context for the request
184:             * @param operation the method that the new <code>Request</code>
185:             *        object will invoke
186:             * @param arg_list the arguments for the method; an <code>NVList</code>
187:             *        in which each argument is a <code>NamedValue</code> object
188:             * @param result a <code>NamedValue</code> object to be used for 
189:             *        returning the result of executing the request's method
190:             * @return a new <code>Request</code> object initialized with the
191:             *         given context, method, argument list, and container for the
192:             *         return value
193:             */
194:            public Request _create_request(Context ctx, String operation,
195:                    NVList arg_list, NamedValue result) {
196:                return _get_delegate().create_request(this , ctx, operation,
197:                        arg_list, result);
198:            }
199:
200:            /**
201:             * Creates a <code>Request</code> object that contains the given context,
202:             * method, argument list, container for the result, exceptions, and
203:             * list of property names to be used in resolving the context strings.
204:             * This <code>Request</code> object is for use in the Dynamic
205:             * Invocation Interface.
206:             *
207:             * @param ctx the <code>Context</code> object that contains the
208:             *        context strings that must be resolved before they are 
209:             *        sent along with the request
210:             * @param operation the method that the new <code>Request</code>
211:             *        object will invoke
212:             * @param arg_list the arguments for the method; an <code>NVList</code>
213:             *        in which each argument is a <code>NamedValue</code> object
214:             * @param result a <code>NamedValue</code> object to be used for 
215:             *        returning the result of executing the request's method
216:             * @param exceptions a list of the exceptions that the given method
217:             *        throws
218:             * @param contexts a list of the properties that are needed to
219:             *        resolve the contexts in <i>ctx</i>; the strings in 
220:             *        <i>contexts</i> are used as arguments to the method
221:             *        <code>Context.get_values</code>,
222:             *        which returns the value associated with the given property
223:             * @return a new <code>Request</code> object initialized with the
224:             *         given context strings to resolve, method, argument list,
225:             *         container for the result, exceptions, and list of property
226:             *         names to be used in resolving the context strings
227:             */
228:            public Request _create_request(Context ctx, String operation,
229:                    NVList arg_list, NamedValue result,
230:                    ExceptionList exceptions, ContextList contexts) {
231:                return _get_delegate().create_request(this , ctx, operation,
232:                        arg_list, result, exceptions, contexts);
233:            }
234:
235:            /** 
236:             * Retrieves the interface definition for this <code>ObjectImpl</code>
237:             * object.
238:             *
239:             * @return the <code>org.omg.CORBA.Object</code> instance that is the
240:             *         interface definition for this <code>ObjectImpl</code> object
241:             */
242:            public org.omg.CORBA.Object _get_interface_def() {
243:                // First try to call the delegate implementation class's
244:                // "Object get_interface_def(..)" method (will work for JDK1.2 ORBs).
245:                // Else call the delegate implementation class's
246:                // "InterfaceDef get_interface(..)" method using reflection
247:                // (will work for pre-JDK1.2 ORBs).
248:
249:                org.omg.CORBA.portable.Delegate delegate = _get_delegate();
250:                try {
251:                    // If the ORB's delegate class does not implement 
252:                    // "Object get_interface_def(..)", this will call 
253:                    // get_interface_def(..) on portable.Delegate. 
254:                    return delegate.get_interface_def(this );
255:                } catch (org.omg.CORBA.NO_IMPLEMENT ex) {
256:                    // Call "InterfaceDef get_interface(..)" method using reflection.
257:                    try {
258:                        Class[] argc = { org.omg.CORBA.Object.class };
259:                        java.lang.reflect.Method meth = delegate.getClass()
260:                                .getMethod("get_interface", argc);
261:                        Object[] argx = { this  };
262:                        return (org.omg.CORBA.Object) meth.invoke(delegate,
263:                                argx);
264:                    } catch (java.lang.reflect.InvocationTargetException exs) {
265:                        Throwable t = exs.getTargetException();
266:                        if (t instanceof  Error) {
267:                            throw (Error) t;
268:                        } else if (t instanceof  RuntimeException) {
269:                            throw (RuntimeException) t;
270:                        } else {
271:                            throw new org.omg.CORBA.NO_IMPLEMENT();
272:                        }
273:                    } catch (RuntimeException rex) {
274:                        throw rex;
275:                    } catch (Exception exr) {
276:                        throw new org.omg.CORBA.NO_IMPLEMENT();
277:                    }
278:                }
279:            }
280:
281:            /** 
282:             * Returns a reference to the ORB associated with this object and
283:             * its delegate.  This is the <code>ORB</code> object that created 
284:             * the delegate.
285:             *
286:             * @return the <code>ORB</code> instance that created the 
287:             *          <code>Delegate</code> object contained in this
288:             *          <code>ObjectImpl</code> object
289:             */
290:            public org.omg.CORBA.ORB _orb() {
291:                return _get_delegate().orb(this );
292:            }
293:
294:            /**
295:             * Retrieves the <code>Policy</code> object for this
296:             * <code>ObjectImpl</code> object that has the given
297:             * policy type.
298:             *
299:             * @param policy_type an int indicating the policy type
300:             * @return the <code>Policy</code> object that is the specified policy type
301:             *         and that applies to this <code>ObjectImpl</code> object 
302:             * @see org.omg.CORBA.PolicyOperations#policy_type
303:             */
304:            public org.omg.CORBA.Policy _get_policy(int policy_type) {
305:                return _get_delegate().get_policy(this , policy_type);
306:            }
307:
308:            /**
309:             * Retrieves a list of the domain managers for this
310:             * <code>ObjectImpl</code> object.
311:             *
312:             * @return an array containing the <code>DomainManager</code> 
313:             *         objects for this instance of <code>ObjectImpl</code>
314:             */
315:            public org.omg.CORBA.DomainManager[] _get_domain_managers() {
316:                return _get_delegate().get_domain_managers(this );
317:            }
318:
319:            /**
320:             * Sets this <code>ObjectImpl</code> object's override type for
321:             * the given policies to the given instance of 
322:             * <code>SetOverrideType</code>.
323:             * 
324:             * @param policies an array of <code>Policy</code> objects with the
325:             *         policies that will replace the current policies or be
326:             *         added to the current policies
327:             * @param set_add either <code>SetOverrideType.SET_OVERRIDE</code>, 
328:             *         indicating that the given policies will replace any existing 
329:             *         ones, or <code>SetOverrideType.ADD_OVERRIDE</code>, indicating
330:             *         that the given policies should be added to any existing ones
331:             * @return an <code>Object</code> with the given policies replacing or
332:             *         added to its previous policies
333:             */
334:            public org.omg.CORBA.Object _set_policy_override(
335:                    org.omg.CORBA.Policy[] policies,
336:                    org.omg.CORBA.SetOverrideType set_add) {
337:                return _get_delegate().set_policy_override(this , policies,
338:                        set_add);
339:            }
340:
341:            /**
342:             * Checks whether this <code>ObjectImpl</code> object is implemented 
343:             * by a local servant.  If so, local invocation API's may be used. 
344:             *
345:             * @return <code>true</code> if this object is implemented by a local
346:             *         servant; <code>false</code> otherwise
347:             */
348:            public boolean _is_local() {
349:                return _get_delegate().is_local(this );
350:            }
351:
352:            /**
353:             * Returns a Java reference to the local servant that should be used for sending
354:             * a request for the method specified. If this <code>ObjectImpl</code>
355:             * object is a local stub, it will invoke the <code>_servant_preinvoke</code>
356:             * method before sending a request in order to obtain the 
357:             * <code>ServantObject</code> instance to use.
358:             * <P>
359:             * If a <code>ServantObject</code> object is returned, its <code>servant</code>
360:             * field has been set to an object of the expected type (Note: the object may 
361:             * or may not be the actual servant instance). The local stub may cast 
362:             * the servant field to the expected type, and then invoke the operation 
363:             * directly. The <code>ServantRequest</code> object is valid for only one
364:             * invocation and cannot be used for more than one invocation.
365:             *
366:             * @param operation a <code>String</code> containing the name of the method
367:             *        to be invoked. This name should correspond to the method name as
368:             *        it would be encoded in a GIOP request.
369:             *
370:             * @param expectedType a <code>Class</code> object representing the
371:             *        expected type of the servant that is returned. This expected 
372:             *        type is the <code>Class</code> object associated with the
373:             *        operations class for the stub's interface. For example, a 
374:             *        stub for an interface <code>Foo</code> would pass the 
375:             *        <code>Class</code> object for the <code>FooOperations</code>
376:             *        interface.
377:             *
378:             * @return (1) a <code>ServantObject</code> object, which may or may
379:             *         not be the actual servant instance, or (2) <code>null</code> if
380:             *         (a) the servant is not local or (b) the servant has ceased to
381:             *         be local due to a ForwardRequest from a POA ServantManager
382:             * @throws org.omg.CORBA.BAD_PARAM if the servant is not the expected type
383:             */
384:            public ServantObject _servant_preinvoke(String operation,
385:                    Class expectedType) {
386:                return _get_delegate().servant_preinvoke(this , operation,
387:                        expectedType);
388:            }
389:
390:            /**
391:             * Is called by the local stub after it has invoked an operation 
392:             * on the local servant that was previously retrieved from a
393:             * call to the method <code>_servant_preinvoke</code>.
394:             * The <code>_servant_postinvoke</code> method must be called
395:             * if the <code>_servant_preinvoke</code> 
396:             * method returned a non-null value, even if an exception was thrown
397:             * by the method invoked by the servant. For this reason, the call
398:             * to the method <code>_servant_postinvoke</code> should be placed 
399:             * in a Java <code>finally</code> clause.
400:             *
401:             * @param servant the instance of the <code>ServantObject</code>
402:             *        returned by the <code>_servant_preinvoke</code> method
403:             */
404:            public void _servant_postinvoke(ServantObject servant) {
405:                _get_delegate().servant_postinvoke(this , servant);
406:            }
407:
408:            /*
409:             * The following methods were added by orbos/98-04-03: Java to IDL
410:             * Mapping. These are used by RMI over IIOP.
411:             */
412:
413:            /**
414:             * Returns an <code>OutputStream</code> object to use for marshalling
415:             * the arguments of the given method.  This method is called by a stub,
416:             * which must indicate if a response is expected, that is, whether or not
417:             * the call is oneway.
418:             *
419:             * @param operation         a String giving the name of the method.
420:             * @param responseExpected  a boolean -- <code>true</code> if the 
421:             *         request is not one way, that is, a response is expected
422:             * @return an <code>OutputStream</code> object for dispatching the request
423:             */
424:            public OutputStream _request(String operation,
425:                    boolean responseExpected) {
426:                return _get_delegate().request(this , operation,
427:                        responseExpected);
428:            }
429:
430:            /**
431:             * Invokes an operation and returns an <code>InputStream</code>
432:             * object for reading the response. The stub provides the
433:             * <code>OutputStream</code> object that was previously returned by a
434:             * call to the <code>_request</code> method. The method specified
435:             * as an argument to <code>_request</code> when it was
436:             * called previously is the method that this method invokes.
437:             * <P>
438:             * If an exception occurs, the <code>_invoke</code> method may throw an
439:             * <code>ApplicationException</code> object that contains an InputStream from
440:             * which the user exception state may be unmarshalled.
441:             *
442:             * @param output  an OutputStream object for dispatching the request
443:             * @return an <code>InputStream</code> object containing the marshalled
444:             *         response to the method invoked
445:             * @throws ApplicationException if the invocation 
446:             *         meets application-defined exception
447:             * @throws RemarshalException if the invocation leads
448:             *         to a remarshalling error
449:             * @see #_request
450:             */
451:            public InputStream _invoke(OutputStream output)
452:                    throws ApplicationException, RemarshalException {
453:                return _get_delegate().invoke(this , output);
454:            }
455:
456:            /**
457:             * Releases the given 
458:             * reply stream back to the ORB when unmarshalling has
459:             * completed after a call to the method <code>_invoke</code>.
460:             * Calling this method is optional for the stub.
461:             * 
462:             * @param input  the <code>InputStream</code> object that was returned
463:             *        by the <code>_invoke</code> method or the 
464:             *        <code>ApplicationException.getInputStream</code> method;
465:             *        may be <code>null</code>, in which case this method does
466:             *        nothing
467:             * @see #_invoke
468:             */
469:            public void _releaseReply(InputStream input) {
470:                _get_delegate().releaseReply(this , input);
471:            }
472:
473:            /**
474:             * Returns a <code>String</code> object that represents this
475:             * <code>ObjectImpl</code> object.
476:             *
477:             * @return the <code>String</code> representation of this object
478:             */
479:            public String toString() {
480:                if (__delegate != null)
481:                    return __delegate.toString(this );
482:                else
483:                    return getClass().getName() + ": no delegate set";
484:            }
485:
486:            /**
487:             * Returns the hash code for this <code>ObjectImpl</code> object.
488:             *
489:             * @return the hash code for this object
490:             */
491:            public int hashCode() {
492:                if (__delegate != null)
493:                    return __delegate.hashCode(this );
494:                else
495:                    return super .hashCode();
496:            }
497:
498:            /**
499:             * Compares this <code>ObjectImpl</code> object with the given one
500:             * for equality.  
501:             *
502:             *@param obj the object with which to compare this object
503:             *@return <code>true</code> if the two objects are equal;
504:             *        <code>false</code> otherwise
505:             */
506:            public boolean equals(java.lang.Object obj) {
507:                if (__delegate != null)
508:                    return __delegate.equals(this, obj);
509:                else
510:                    return (this == obj);
511:            }
512:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.