54 |
import org.omg.CORBA.BAD_INV_ORDER; |
import org.omg.CORBA.BAD_INV_ORDER; |
55 |
import org.omg.CORBA.BAD_PARAM; |
import org.omg.CORBA.BAD_PARAM; |
56 |
import org.omg.CORBA.Bounds; |
import org.omg.CORBA.Bounds; |
57 |
|
import org.omg.CORBA.COMM_FAILURE; |
58 |
import org.omg.CORBA.CompletionStatus; |
import org.omg.CORBA.CompletionStatus; |
59 |
import org.omg.CORBA.Context; |
import org.omg.CORBA.Context; |
60 |
import org.omg.CORBA.ContextList; |
import org.omg.CORBA.ContextList; |
715 |
/** |
/** |
716 |
* Do the actual invocation. This implementation requires to set the IOR |
* Do the actual invocation. This implementation requires to set the IOR |
717 |
* property ({@link #setIOR(IOR)} before calling this method. |
* property ({@link #setIOR(IOR)} before calling this method. |
718 |
* |
* |
719 |
* @throws BAD_INV_ORDER, minor code 0, if the IOR has not been previously set |
* @throws BAD_INV_ORDER, minor code 0, if the IOR has not been previously set |
720 |
* or if the direct argument addition is mixed with the direct argument |
* or if the direct argument addition is mixed with the direct argument |
721 |
* writing into the output stream. |
* writing into the output stream. |
722 |
* |
* |
723 |
* @return the server response in binary form. |
* @return the server response in binary form. |
724 |
*/ |
*/ |
725 |
public synchronized binaryReply submit() throws ForwardRequest |
public synchronized binaryReply submit() throws ForwardRequest |
726 |
{ |
{ |
727 |
gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader(); |
gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader(); |
728 |
|
|
836 |
MessageHeader response_header = new MessageHeader(); |
MessageHeader response_header = new MessageHeader(); |
837 |
InputStream socketInput = socket.getInputStream(); |
InputStream socketInput = socket.getInputStream(); |
838 |
response_header.read(socketInput); |
response_header.read(socketInput); |
839 |
|
|
840 |
byte[] r = new byte[ response_header.message_size ]; |
byte [] r; |
841 |
int n = 0; |
if (orb instanceof Functional_ORB) |
|
reading: |
|
|
while (n < r.length) |
|
842 |
{ |
{ |
843 |
n += socketInput.read(r, n, r.length - n); |
Functional_ORB fo = (Functional_ORB) orb; |
844 |
|
r =response_header.readMessage(socketInput, socket, |
845 |
|
fo.TOUT_WHILE_READING, fo.TOUT_AFTER_RECEIVING); |
846 |
} |
} |
847 |
|
else |
848 |
|
r = response_header.readMessage(socketInput, null, 0, 0); |
849 |
|
|
850 |
return new binaryReply(orb, response_header, r); |
return new binaryReply(orb, response_header, r); |
851 |
} |
} |
852 |
else |
else |
854 |
} |
} |
855 |
catch (IOException io_ex) |
catch (IOException io_ex) |
856 |
{ |
{ |
857 |
MARSHAL m = |
COMM_FAILURE m = |
858 |
new MARSHAL("Unable to open a socket at " + ior.Internet.host + ":" + |
new COMM_FAILURE("Unable to open a socket at " + ior.Internet.host + ":" + |
859 |
ior.Internet.port, 10000 + ior.Internet.port, |
ior.Internet.port, 0xC9, |
860 |
CompletionStatus.COMPLETED_NO |
CompletionStatus.COMPLETED_NO |
861 |
); |
); |
862 |
m.initCause(io_ex); |
m.initCause(io_ex); |
933 |
* Do actual invocation. This method recursively calls itself if the |
* Do actual invocation. This method recursively calls itself if the |
934 |
* redirection is detected. |
* redirection is detected. |
935 |
*/ |
*/ |
936 |
private void p_invoke() throws SystemException, ForwardRequest |
private void p_invoke() |
937 |
|
throws SystemException, ForwardRequest |
938 |
{ |
{ |
939 |
binaryReply response = submit(); |
binaryReply response = submit(); |
940 |
|
|
951 |
|
|
952 |
switch (m_rph.reply_status) |
switch (m_rph.reply_status) |
953 |
{ |
{ |
954 |
case ReplyHeader.NO_EXCEPTION : |
case ReplyHeader.NO_EXCEPTION: |
955 |
|
|
956 |
NamedValue arg; |
NamedValue arg; |
957 |
|
|
997 |
|
|
998 |
break; |
break; |
999 |
|
|
1000 |
case ReplyHeader.SYSTEM_EXCEPTION : |
case ReplyHeader.SYSTEM_EXCEPTION: |
1001 |
if (align) |
if (align) |
1002 |
{ |
{ |
1003 |
input.align(8); |
input.align(8); |
1005 |
} |
} |
1006 |
readExceptionId(input); |
readExceptionId(input); |
1007 |
|
|
1008 |
m_sys_ex = ObjectCreator.readSystemException(input); |
m_sys_ex = ObjectCreator.readSystemException(input, |
1009 |
|
m_rph.service_context); |
1010 |
m_environment.exception(m_sys_ex); |
m_environment.exception(m_sys_ex); |
1011 |
|
|
1012 |
if (m_interceptor != null) |
if (m_interceptor != null) |
1014 |
|
|
1015 |
throw m_sys_ex; |
throw m_sys_ex; |
1016 |
|
|
1017 |
case ReplyHeader.USER_EXCEPTION : |
case ReplyHeader.USER_EXCEPTION: |
1018 |
if (align) |
if (align) |
1019 |
{ |
{ |
1020 |
input.align(8); |
input.align(8); |
1036 |
|
|
1037 |
break; |
break; |
1038 |
|
|
1039 |
case ReplyHeader.LOCATION_FORWARD_PERM : |
case ReplyHeader.LOCATION_FORWARD_PERM: |
1040 |
case ReplyHeader.LOCATION_FORWARD : |
case ReplyHeader.LOCATION_FORWARD: |
1041 |
if (response.header.version.since_inclusive(1, 2)) |
if (response.header.version.since_inclusive(1, 2)) |
1042 |
input.align(8); |
input.align(8); |
1043 |
|
|
1049 |
catch (IOException ex) |
catch (IOException ex) |
1050 |
{ |
{ |
1051 |
new MARSHAL("Cant read forwarding info", 5103, |
new MARSHAL("Cant read forwarding info", 5103, |
1052 |
CompletionStatus.COMPLETED_NO |
CompletionStatus.COMPLETED_NO); |
|
); |
|
1053 |
} |
} |
1054 |
|
|
1055 |
setIor(forwarded); |
setIor(forwarded); |
1063 |
p_invoke(); |
p_invoke(); |
1064 |
return; |
return; |
1065 |
|
|
1066 |
default : |
default: |
1067 |
throw new MARSHAL("Unknow reply status", 8100 + m_rph.reply_status, |
throw new MARSHAL("Unknow reply status", 8100 + m_rph.reply_status, |
1068 |
CompletionStatus.COMPLETED_NO |
CompletionStatus.COMPLETED_NO); |
|
); |
|
1069 |
} |
} |
1070 |
} |
} |
1071 |
|
|