1*2be43276SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2be43276SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2be43276SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2be43276SAndrew Rist * distributed with this work for additional information 6*2be43276SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2be43276SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2be43276SAndrew Rist * "License"); you may not use this file except in compliance 9*2be43276SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*2be43276SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*2be43276SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2be43276SAndrew Rist * software distributed under the License is distributed on an 15*2be43276SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2be43276SAndrew Rist * KIND, either express or implied. See the License for the 17*2be43276SAndrew Rist * specific language governing permissions and limitations 18*2be43276SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*2be43276SAndrew Rist *************************************************************/ 21*2be43276SAndrew Rist 22*2be43276SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package com.sun.star.lib.uno.environments.remote; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import com.sun.star.uno.IMethodDescription; 27cdf0e10cSrcweir import com.sun.star.uno.ITypeDescription; 28cdf0e10cSrcweir import com.sun.star.uno.XCurrentContext; 29cdf0e10cSrcweir 30cdf0e10cSrcweir /** 31cdf0e10cSrcweir A remote request or reply message. 32cdf0e10cSrcweir */ 33cdf0e10cSrcweir public class Message { Message( ThreadId threadId, boolean request, String objectId, ITypeDescription type, IMethodDescription method, boolean synchronous, XCurrentContext currentContext, boolean abnormalTermination, Object result, Object[] arguments)34cdf0e10cSrcweir public Message( 35cdf0e10cSrcweir ThreadId threadId, boolean request, String objectId, 36cdf0e10cSrcweir ITypeDescription type, IMethodDescription method, boolean synchronous, 37cdf0e10cSrcweir XCurrentContext currentContext, boolean abnormalTermination, 38cdf0e10cSrcweir Object result, Object[] arguments) 39cdf0e10cSrcweir { 40cdf0e10cSrcweir this.threadId = threadId; 41cdf0e10cSrcweir this.request = request; 42cdf0e10cSrcweir this.objectId = objectId; 43cdf0e10cSrcweir this.type = type; 44cdf0e10cSrcweir this.method = method; 45cdf0e10cSrcweir this.synchronous = synchronous; 46cdf0e10cSrcweir this.currentContext = currentContext; 47cdf0e10cSrcweir this.abnormalTermination = abnormalTermination; 48cdf0e10cSrcweir this.result = result; 49cdf0e10cSrcweir this.arguments = arguments; 50cdf0e10cSrcweir } 51cdf0e10cSrcweir 52cdf0e10cSrcweir /** 53cdf0e10cSrcweir Returns the thread ID of the message. 54cdf0e10cSrcweir 55cdf0e10cSrcweir <p>Valid for all kinds of messages.</p> 56cdf0e10cSrcweir 57cdf0e10cSrcweir @return the (non-<code>null</code>) thread ID 58cdf0e10cSrcweir */ getThreadId()59cdf0e10cSrcweir public final ThreadId getThreadId() { 60cdf0e10cSrcweir return threadId; 61cdf0e10cSrcweir } 62cdf0e10cSrcweir 63cdf0e10cSrcweir /** 64cdf0e10cSrcweir Returns whether the message is a request or a reply. 65cdf0e10cSrcweir 66cdf0e10cSrcweir <p>Valid for all kinds of messages.</p> 67cdf0e10cSrcweir 68cdf0e10cSrcweir @return <code>true</code> for a request, <code>false</code> for a reply 69cdf0e10cSrcweir */ isRequest()70cdf0e10cSrcweir public final boolean isRequest() { 71cdf0e10cSrcweir return request; 72cdf0e10cSrcweir } 73cdf0e10cSrcweir 74cdf0e10cSrcweir /** 75cdf0e10cSrcweir Returns the object ID of a request message. 76cdf0e10cSrcweir 77cdf0e10cSrcweir <p>Valid only for request messages.</p> 78cdf0e10cSrcweir 79cdf0e10cSrcweir @return the (non-<code>null</code>) object ID for a request, 80cdf0e10cSrcweir <code>null</code> for a reply 81cdf0e10cSrcweir */ getObjectId()82cdf0e10cSrcweir public final String getObjectId() { 83cdf0e10cSrcweir return objectId; 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir /** 87cdf0e10cSrcweir Returns the type of a request message. 88cdf0e10cSrcweir 89cdf0e10cSrcweir <p>Valid only for request messages.</p> 90cdf0e10cSrcweir 91cdf0e10cSrcweir @return the (non-<code>null</code>) type for a request, <code>null</code> 92cdf0e10cSrcweir for a reply 93cdf0e10cSrcweir */ getType()94cdf0e10cSrcweir public final ITypeDescription getType() { 95cdf0e10cSrcweir return type; 96cdf0e10cSrcweir } 97cdf0e10cSrcweir 98cdf0e10cSrcweir /** 99cdf0e10cSrcweir Returns the method description of a request message. 100cdf0e10cSrcweir 101cdf0e10cSrcweir <p>Valid only for request messages. The returned 102cdf0e10cSrcweir <code>IMethodDescription</code> is consistent with the type of the 103cdf0e10cSrcweir message.</p> 104cdf0e10cSrcweir 105cdf0e10cSrcweir @return the (non-<code>null</code>) method description for a request, 106cdf0e10cSrcweir <code>null</code> for a reply 107cdf0e10cSrcweir */ getMethod()108cdf0e10cSrcweir public final IMethodDescription getMethod() { 109cdf0e10cSrcweir return method; 110cdf0e10cSrcweir } 111cdf0e10cSrcweir 112cdf0e10cSrcweir /** 113cdf0e10cSrcweir Returns whether the request message is synchronous. 114cdf0e10cSrcweir 115cdf0e10cSrcweir <p>Valid only for request messages.</p> 116cdf0e10cSrcweir 117cdf0e10cSrcweir @return <code>true</code> for a synchronous request, <code>false</code> 118cdf0e10cSrcweir for an asynchronous request or a reply 119cdf0e10cSrcweir */ isSynchronous()120cdf0e10cSrcweir public final boolean isSynchronous() { 121cdf0e10cSrcweir return synchronous; 122cdf0e10cSrcweir } 123cdf0e10cSrcweir 124cdf0e10cSrcweir /** 125cdf0e10cSrcweir Returns the current context of a request message. 126cdf0e10cSrcweir 127cdf0e10cSrcweir <p>Valid only for request messages.</p> 128cdf0e10cSrcweir 129cdf0e10cSrcweir @return the current context (which may be <code>null</code>) for a 130cdf0e10cSrcweir request, <code>null</code> for a reply 131cdf0e10cSrcweir */ getCurrentContext()132cdf0e10cSrcweir public XCurrentContext getCurrentContext() { 133cdf0e10cSrcweir return currentContext; 134cdf0e10cSrcweir } 135cdf0e10cSrcweir 136cdf0e10cSrcweir /** 137cdf0e10cSrcweir Returns whether the reply message represents abnormal termination. 138cdf0e10cSrcweir 139cdf0e10cSrcweir <p>Valid only for reply messages.</p> 140cdf0e10cSrcweir 141cdf0e10cSrcweir @return <code>true</code> for a reply that represents abnormal 142cdf0e10cSrcweir termination, <code>false</code> for a reply that represents normal 143cdf0e10cSrcweir termination or a request 144cdf0e10cSrcweir */ isAbnormalTermination()145cdf0e10cSrcweir public final boolean isAbnormalTermination() { 146cdf0e10cSrcweir return abnormalTermination; 147cdf0e10cSrcweir } 148cdf0e10cSrcweir 149cdf0e10cSrcweir /** 150cdf0e10cSrcweir Returns the result of a reply message. 151cdf0e10cSrcweir 152cdf0e10cSrcweir <p>Valid only for reply messages.</p> 153cdf0e10cSrcweir 154cdf0e10cSrcweir @return any (possibly <code>null</code>) return value for a reply that 155cdf0e10cSrcweir represents normal termination, the (non-<code>null</code>) exception for 156cdf0e10cSrcweir a reply that represents abnormal termination, <code>null</code> for a 157cdf0e10cSrcweir request 158cdf0e10cSrcweir */ getResult()159cdf0e10cSrcweir public final Object getResult() { 160cdf0e10cSrcweir return result; 161cdf0e10cSrcweir } 162cdf0e10cSrcweir 163cdf0e10cSrcweir /** 164cdf0e10cSrcweir Returns the arguments of a message. 165cdf0e10cSrcweir 166cdf0e10cSrcweir <p>Valid only for request messages and reply messages that represent 167cdf0e10cSrcweir normal termination. Any returned array must not be modified.</p> 168cdf0e10cSrcweir 169cdf0e10cSrcweir @return the in and in&ndash { 170cdf0e10cSrcweir }out arguments for a request (possibly 171cdf0e10cSrcweir <code>null</code> for a paramterless function), the out and in&dash { 172cdf0e10cSrcweir }out 173cdf0e10cSrcweir arguments for a reply that represents normal termination (possibly 174cdf0e10cSrcweir <code>null</code> for a parameterless function), <code>null</code> for a 175cdf0e10cSrcweir reply that represents abnormal termination 176cdf0e10cSrcweir */ getArguments()177cdf0e10cSrcweir public final Object[] getArguments() { 178cdf0e10cSrcweir return arguments; 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir private final ThreadId threadId; 182cdf0e10cSrcweir private final boolean request; 183cdf0e10cSrcweir private final String objectId; 184cdf0e10cSrcweir private final ITypeDescription type; 185cdf0e10cSrcweir private final IMethodDescription method; 186cdf0e10cSrcweir private final boolean synchronous; 187cdf0e10cSrcweir private final XCurrentContext currentContext; 188cdf0e10cSrcweir private final boolean abnormalTermination; 189cdf0e10cSrcweir private final Object result; 190cdf0e10cSrcweir private final Object[] arguments; 191cdf0e10cSrcweir } 192