Main Page   Packages   Class Hierarchy   Compound List   File List   Compound Members  

JStubFactory::ClientDelegate Class Reference

Inheritance diagram for JStubFactory::ClientDelegate:

Inheritance graph
[legend]
Collaboration diagram for JStubFactory::ClientDelegate:

Collaboration graph
[legend]
List of all members.

Public Methods

 ClientDelegate (Identifier[] ids, SessionIdentifier session_id, Boolean java_serial)
boolean is_local (org.omg.CORBA.Object self)
ORB orb (org.omg.CORBA.Object obj)
Request create_request (org.omg.CORBA.Object obj, Context ctx, String operation, NVList arg_list, NamedValue result)
Request create_request (org.omg.CORBA.Object obj, Context ctx, String operation, NVList arg_list, NamedValue result, ExceptionList exclist, ContextList ctxlist)
Request request (org.omg.CORBA.Object obj, String operation)
OutputStream request (org.omg.CORBA.Object self, String operation, boolean response_expected)
InputStream invoke (org.omg.CORBA.Object self, OutputStream output) throws ApplicationException, RemarshalException
void releaseReply (org.omg.CORBA.Object self, InputStream input)
boolean is_a (org.omg.CORBA.Object self, String logical_type_id)
boolean non_existent (org.omg.CORBA.Object self)

Protected Methods

void finalize ()

Private Methods

JStubFactory stubFactory ()
void invoke (DavidOutputStream stream)
ReplyInterface request (DavidOutputStream os, String operation, boolean response_expected)
DavidInputStream getResponse (org.omg.CORBA.Object self, ReplyInterface reply) throws ApplicationException, RemarshalException

Private Attributes

SessionIdentifier session_id
Session_High session
Boolean java_serial

Detailed Description

Type of the client-side delegates.

Definition at line 311 of file JStubFactory.java.


Constructor & Destructor Documentation

JStubFactory::ClientDelegate::ClientDelegate ( Identifier ids[],
SessionIdentifier session_id,
Boolean java_serial ) [inline]
 

Creates a new ClientDelegate.

Parameters:
ids   a set of identifiers;
session_id   a protocol session identifier.

Definition at line 322 of file JStubFactory.java.

00323                                                  {
00324          super(ids);
00325          this.session_id = session_id;
00326          this.java_serial = java_serial;
00327       }


Member Function Documentation

Request JStubFactory::ClientDelegate::create_request ( org.omg.CORBA.Object obj,
Context ctx,
String operation,
NVList arg_list,
NamedValue result,
ExceptionList exclist,
ContextList ctxlist ) [inline]
 

Reimplemented from JDelegate.

Definition at line 356 of file JStubFactory.java.

00362                                                          {
00363          return new RequestImpl(this,obj,ctx,operation,arg_list,result,
00364                                 exclist,ctxlist);
00365       }

Request JStubFactory::ClientDelegate::create_request ( org.omg.CORBA.Object obj,
Context ctx,
String operation,
NVList arg_list,
NamedValue result ) [inline]
 

Reimplemented from JDelegate.

Definition at line 346 of file JStubFactory.java.

00350                                                        {
00351          return new RequestImpl(this,obj,ctx,operation,arg_list,result,
00352                                 orb.create_exception_list(),
00353                                 orb.create_context_list());
00354       }

void JStubFactory::ClientDelegate::finalize ( ) [inline, protected]
 

Standard finalize method.

Reimplemented from JDelegate.

Definition at line 329 of file JStubFactory.java.

00329                                 {
00330          super.finalize();
00331          if (session != null) {
00332             session.close();
00333             session = null;
00334          }
00335       }

DavidInputStream JStubFactory::ClientDelegate::getResponse ( org.omg.CORBA.Object self,
ReplyInterface reply ) [inline, private]
 

Definition at line 497 of file JStubFactory.java.

00498                                                          {
00499          try {
00500             UnMarshaller unmarshaller = reply.listen();
00501             unmarshaller.getContext().addElement("java_serial",Boolean.class,
00502                                                  java_serial,(char) 0);
00503             return (DavidInputStream) unmarshaller;
00504          } catch (ForwardException e) {
00505             ObjectImpl impl = (ObjectImpl) e.reference;
00506             Delegate delegate = impl._get_delegate();
00507             ((ObjectImpl) self)._set_delegate(delegate);
00508             if (refs > 1) {
00509                Object dup = self._duplicate();
00510                if (dup == self) {
00511                   while (refs > 2) {
00512                      self._duplicate();
00513                      refs--;
00514                   }
00515                } // else, it is not possible to be correct...
00516             }
00517             throw new RemarshalException();
00518          } catch (ServerException e) {
00519             UnMarshaller unmarshaller = e.unmarshaller;
00520             try {
00521                unmarshaller.getContext().addElement("java_serial",Boolean.class,
00522                                                     java_serial,(char) 0);
00523             } catch (JonathanException pb) {
00524                unmarshaller.close();
00525                pb.printStackTrace();
00526                throw new InternalException("Configuration problem: " + pb);
00527             }
00528             throw new ApplicationException(null, (InputStream) unmarshaller);
00529          } catch (Exception e) {
00530             //e.printStackTrace();
00531             throw CORBAHelpers.systemException(e,CompletionStatus.COMPLETED_YES);
00532          }
00533       }      

void JStubFactory::ClientDelegate::invoke ( DavidOutputStream stream ) [inline, private]
 

Definition at line 461 of file JStubFactory.java.

00461                                             {
00462          CompletionStatus completed = CompletionStatus.COMPLETED_NO;
00463          try {
00464             // synchro
00465             if (session == null) {
00466                session = session_id.bind(null);
00467             }
00468             completed = CompletionStatus.COMPLETED_MAYBE;
00469             session.send(stream);
00470          } catch (Exception e) {
00471             throw CORBAHelpers.systemException(e,completed);
00472          }
00473       }

InputStream JStubFactory::ClientDelegate::invoke ( org.omg.CORBA.Object self,
OutputStream output ) [inline]
 

Definition at line 394 of file JStubFactory.java.

00396                                                          {
00397          DavidOutputStream stream = (DavidOutputStream) output;
00398          Object reply = stream.getContext().getValue("reply",(char) 0);
00399          invoke(stream);
00400          if (reply != org.objectweb.jonathan.apis.kernel.Context.NO_VALUE) {
00401             return getResponse(self,(ReplyInterface) reply);
00402          } else {
00403             return null;
00404          }
00405       }

boolean JStubFactory::ClientDelegate::is_a ( org.omg.CORBA.Object self,
String logical_type_id ) [inline]
 

Reimplemented from JDelegate.

Reimplemented in JStubFactory::LocalDelegate.

Definition at line 415 of file JStubFactory.java.

00415                                                                              {
00416          if (super.is_a(self,logical_type_id)) {
00417             return true;
00418          } else {
00419             OutputStream _ostream = request(self,"_is_a",true);
00420             _ostream.write_string(logical_type_id);
00421             try {
00422                InputStream _istream = invoke(self,_ostream);
00423                boolean _ret = _istream.read_boolean();
00424                releaseReply(self,_istream);
00425                return _ret;
00426             } catch (ApplicationException e) {
00427                InputStream _istream = e.getInputStream();
00428                String _id = _istream.read_string();
00429                releaseReply(self,_istream);
00430                throw new UNKNOWN("Caught non declared exception " + _id);
00431             } catch (RemarshalException e) {
00432                return self._is_a(logical_type_id);
00433             }
00434          }
00435       }

boolean JStubFactory::ClientDelegate::is_local ( org.omg.CORBA.Object self ) [inline]
 

Reimplemented in JStubFactory::LocalDelegate.

Definition at line 338 of file JStubFactory.java.

00338                                                          {
00339          return false;
00340       }

boolean JStubFactory::ClientDelegate::non_existent ( org.omg.CORBA.Object self ) [inline]
 

Reimplemented from JDelegate.

Reimplemented in JStubFactory::LocalDelegate.

Definition at line 436 of file JStubFactory.java.

00436                                                              {      
00437          if (super.non_existent(self)) {
00438             return false; // reference is not valid
00439          } else {
00440             OutputStream _ostream = request(self,"_non_existent",true);
00441             try {
00442                InputStream _istream = invoke(self,_ostream);
00443                boolean _ret = _istream.read_boolean();
00444                releaseReply(self,_istream);
00445                return _ret;
00446             } catch (ApplicationException e) {
00447                InputStream _istream = e.getInputStream();
00448                String _id = _istream.read_string();
00449                releaseReply(self,_istream);
00450                throw new UNKNOWN("Caught non declared exception " + _id);
00451             } catch (RemarshalException e) {
00452                return self._non_existent();
00453             }
00454          }
00455       }

ORB JStubFactory::ClientDelegate::orb ( org.omg.CORBA.Object obj ) [inline]
 

Definition at line 342 of file JStubFactory.java.

00342                                                {
00343          return orb;
00344       }

void JStubFactory::ClientDelegate::releaseReply ( org.omg.CORBA.Object self,
InputStream input ) [inline]
 

Definition at line 407 of file JStubFactory.java.

00408                                                   {
00409          DavidInputStream stream = (DavidInputStream) input;
00410          if (stream != null) {
00411             stream.close();
00412          }
00413       }

ReplyInterface JStubFactory::ClientDelegate::request ( DavidOutputStream os,
String operation,
boolean response_expected ) [inline, private]
 

Definition at line 475 of file JStubFactory.java.

00476                                                         {
00477          try {
00478             ReplyInterface reply = null;
00479             // synchro sur la session ?
00480             if (session == null) {
00481                session = session_id.bind(null);
00482             }
00483             if (response_expected) {
00484                reply = session.prepareInvocation(os);
00485             } else {
00486                session.prepare(os);
00487             }
00488             os.writeString8(operation);
00489             os.writeInt(0); // principal
00490             return reply;
00491          } catch (Exception e) {
00492             throw CORBAHelpers.systemException(e,CompletionStatus.COMPLETED_NO);
00493          }
00494       }

OutputStream JStubFactory::ClientDelegate::request ( org.omg.CORBA.Object self,
String operation,
boolean response_expected ) [inline]
 

Definition at line 374 of file JStubFactory.java.

00376                                                              {
00377          try {
00378             DavidOutputStream os = (DavidOutputStream) orb.create_output_stream();
00379             org.objectweb.jonathan.apis.kernel.Context os_context = os.getContext();
00380             os_context.addElement("java_serial",Boolean.class,java_serial,
00381                                   (char) 0);
00382             ReplyInterface reply = request(os,operation,response_expected);
00383             if (response_expected) {
00384                os_context.addElement("reply",ReplyInterface.class,reply,
00385                                      (char) 0);
00386             }
00387             return os;
00388          } catch (JonathanException e) {
00389             e.printStackTrace();
00390             throw new InternalException("Unexpected exception.");
00391          }
00392       }      

Request JStubFactory::ClientDelegate::request ( org.omg.CORBA.Object obj,
String operation ) [inline]
 

Reimplemented from JDelegate.

Definition at line 367 of file JStubFactory.java.

00367                                                                          {
00368          return create_request(obj,null,operation,null,
00369                                orb.create_named_value(null,
00370                                                       orb.create_any(),
00371                                                       0));
00372       }

JStubFactory JStubFactory::ClientDelegate::stubFactory ( ) [inline, private]
 

Definition at line 457 of file JStubFactory.java.

00457                                  {
00458          return JStubFactory.this;
00459       }


Member Data Documentation

Boolean JStubFactory::ClientDelegate::java_serial [private]
 

Definition at line 314 of file JStubFactory.java.

Session_High JStubFactory::ClientDelegate::session [private]
 

Definition at line 313 of file JStubFactory.java.

SessionIdentifier JStubFactory::ClientDelegate::session_id [private]
 

Definition at line 312 of file JStubFactory.java.


The documentation for this class was generated from the following file:
Generated at Fri May 31 19:23:48 2002 for Jonathan by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001