keycloak-federation
公開メンバ関数 | 静的公開メンバ関数 | 静的公開変数類 | 変数 | 全メンバ一覧
org.freedesktop.dbus.RemoteInvocationHandler クラス
org.freedesktop.dbus.RemoteInvocationHandler の継承関係図
Inheritance graph
org.freedesktop.dbus.RemoteInvocationHandler 連携図
Collaboration graph

公開メンバ関数

 RemoteInvocationHandler (AbstractConnection conn, RemoteObject remote)
 
Object invoke (Object proxy, Method method, Object[] args) throws Throwable
 

静的公開メンバ関数

static Object convertRV (String sig, Object[] rp, Method m, AbstractConnection conn) throws DBusException
 
static Object executeRemoteMethod (RemoteObject ro, Method m, AbstractConnection conn, int syncmethod, CallbackHandler callback, Object... args) throws DBusExecutionException
 

静的公開変数類

static final int CALL_TYPE_SYNC = 0
 
static final int CALL_TYPE_ASYNC = 1
 
static final int CALL_TYPE_CALLBACK = 2
 

変数

AbstractConnection conn
 
RemoteObject remote
 

詳解

構築子と解体子

◆ RemoteInvocationHandler()

org.freedesktop.dbus.RemoteInvocationHandler.RemoteInvocationHandler ( AbstractConnection  conn,
RemoteObject  remote 
)
inline
147  {
148  this.remote = remote;
149  this.conn = conn;
150  }
AbstractConnection conn
Definition: RemoteInvocationHandler.java:144
RemoteObject remote
Definition: RemoteInvocationHandler.java:145

関数詳解

◆ convertRV()

static Object org.freedesktop.dbus.RemoteInvocationHandler.convertRV ( String  sig,
Object []  rp,
Method  m,
AbstractConnection  conn 
) throws DBusException
inlinestatic
34  {
35  Class<? extends Object> c = m.getReturnType();
36 
37  if (null == rp) {
38  if (null == c || Void.TYPE.equals(c)) return null;
39  else throw new DBusExecutionException(getString("voidReturnType"));
40  } else {
41  try {
42  if (Debug.debug)
43  Debug.print(Debug.VERBOSE, "Converting return parameters from " + Arrays.deepToString(rp) + " to type " + m.getGenericReturnType());
44  rp = Marshalling.deSerializeParameters(rp,
45  new Type[]{m.getGenericReturnType()}, conn);
46  } catch (Exception e) {
47  if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e);
48  throw new DBusExecutionException(MessageFormat.format(getString("invalidReturnType"), new Object[]{e.getMessage()}));
49  }
50  }
51 
52  switch (rp.length) {
53  case 0:
54  if (null == c || Void.TYPE.equals(c))
55  return null;
56  else throw new DBusExecutionException(getString("voidReturnType"));
57  case 1:
58  return rp[0];
59  default:
60 
61  // check we are meant to return multiple values
62  if (!Tuple.class.isAssignableFrom(c))
63  throw new DBusExecutionException(getString("tupleReturnType"));
64 
65  Constructor<? extends Object> cons = c.getConstructors()[0];
66  try {
67  return cons.newInstance(rp);
68  } catch (Exception e) {
69  if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e);
70  throw new DBusException(e.getMessage());
71  }
72  }
73  }
AbstractConnection conn
Definition: RemoteInvocationHandler.java:144

◆ executeRemoteMethod()

static Object org.freedesktop.dbus.RemoteInvocationHandler.executeRemoteMethod ( RemoteObject  ro,
Method  m,
AbstractConnection  conn,
int  syncmethod,
CallbackHandler  callback,
Object...  args 
) throws DBusExecutionException
inlinestatic
76  {
77  Type[] ts = m.getGenericParameterTypes();
78  String sig = null;
79  if (ts.length > 0) try {
80  sig = Marshalling.getDBusType(ts);
81  args = Marshalling.convertParameters(args, ts, conn);
82  } catch (DBusException DBe) {
83  throw new DBusExecutionException(getString("contructDBusTypeFailure") + DBe.getMessage());
84  }
85  MethodCall call;
86  byte flags = 0;
87  if (!ro.autostart) flags |= Message.Flags.NO_AUTO_START;
88  if (syncmethod == CALL_TYPE_ASYNC) flags |= Message.Flags.ASYNC;
89  if (m.isAnnotationPresent(DBus.Method.NoReply.class)) flags |= Message.Flags.NO_REPLY_EXPECTED;
90  try {
91  String name;
92  if (m.isAnnotationPresent(DBusMemberName.class))
93  name = m.getAnnotation(DBusMemberName.class).value();
94  else
95  name = m.getName();
96  if (null == ro.iface)
97  call = new MethodCall(ro.busname, ro.objectpath, null, name, flags, sig, args);
98  else {
99  if (null != ro.iface.getAnnotation(DBusInterfaceName.class)) {
100  call = new MethodCall(ro.busname, ro.objectpath, ro.iface.getAnnotation(DBusInterfaceName.class).value(), name, flags, sig, args);
101  } else
102  call = new MethodCall(ro.busname, ro.objectpath, AbstractConnection.dollar_pattern.matcher(ro.iface.getName()).replaceAll("."), name, flags, sig, args);
103  }
104  } catch (DBusException DBe) {
105  if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe);
106  throw new DBusExecutionException(getString("constructOutgoingMethodCallFailure") + DBe.getMessage());
107  }
108  if (null == conn.outgoing) throw new NotConnected(getString("notConnected"));
109 
110  switch (syncmethod) {
111  case CALL_TYPE_ASYNC:
112  conn.queueOutgoing(call);
113  return new DBusAsyncReply(call, m, conn);
114  case CALL_TYPE_CALLBACK:
115  synchronized (conn.pendingCallbacks) {
116  if (Debug.debug) Debug.print(Debug.VERBOSE, "Queueing Callback " + callback + " for " + call);
117  conn.pendingCallbacks.put(call, callback);
118  conn.pendingCallbackReplys.put(call, new DBusAsyncReply(call, m, conn));
119  }
120  conn.queueOutgoing(call);
121  return null;
122  case CALL_TYPE_SYNC:
123  conn.queueOutgoing(call);
124  break;
125  }
126 
127  // get reply
128  if (m.isAnnotationPresent(DBus.Method.NoReply.class)) return null;
129 
130  Message reply = call.getReply();
131  if (null == reply) throw new DBus.Error.NoReply(getString("notReplyWithSpecifiedTime"));
132 
133  if (reply instanceof Error)
134  ((Error) reply).throwException();
135 
136  try {
137  return convertRV(reply.getSig(), reply.getParameters(), m, conn);
138  } catch (DBusException e) {
139  if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e);
140  throw new DBusExecutionException(e.getMessage());
141  }
142  }
Map< MethodCall, DBusAsyncReply<? extends Object > > pendingCallbackReplys
Definition: AbstractConnection.java:247
Map< MethodCall, CallbackHandler<? extends Object > > pendingCallbacks
Definition: AbstractConnection.java:246
static final int CALL_TYPE_SYNC
Definition: RemoteInvocationHandler.java:30
AbstractConnection conn
Definition: RemoteInvocationHandler.java:144
void queueOutgoing(Message m)
Definition: AbstractConnection.java:481
static Object convertRV(String sig, Object[] rp, Method m, AbstractConnection conn)
Definition: RemoteInvocationHandler.java:34
static final int CALL_TYPE_ASYNC
Definition: RemoteInvocationHandler.java:31
EfficientQueue outgoing
Definition: AbstractConnection.java:252
static final int CALL_TYPE_CALLBACK
Definition: RemoteInvocationHandler.java:32

◆ invoke()

Object org.freedesktop.dbus.RemoteInvocationHandler.invoke ( Object  proxy,
Method  method,
Object []  args 
) throws Throwable
inline
152  {
153  if (method.getName().equals("isRemote")) return true;
154  else if (method.getName().equals("clone")) return null;
155  else if (method.getName().equals("equals")) {
156  try {
157  if (1 == args.length)
158  return new Boolean(remote.equals(((RemoteInvocationHandler) Proxy.getInvocationHandler(args[0])).remote));
159  } catch (IllegalArgumentException IAe) {
160  return Boolean.FALSE;
161  }
162  } else if (method.getName().equals("finalize")) return null;
163  else if (method.getName().equals("getClass")) return DBusInterface.class;
164  else if (method.getName().equals("hashCode")) return remote.hashCode();
165  else if (method.getName().equals("notify")) {
166  remote.notify();
167  return null;
168  } else if (method.getName().equals("notifyAll")) {
169  remote.notifyAll();
170  return null;
171  } else if (method.getName().equals("wait")) {
172  if (0 == args.length) remote.wait();
173  else if (1 == args.length
174  && args[0] instanceof Long) remote.wait((Long) args[0]);
175  else if (2 == args.length
176  && args[0] instanceof Long
177  && args[1] instanceof Integer)
178  remote.wait((Long) args[0], (Integer) args[1]);
179  if (args.length <= 2)
180  return null;
181  } else if (method.getName().equals("toString"))
182  return remote.toString();
183 
184  return executeRemoteMethod(remote, method, conn, CALL_TYPE_SYNC, null, args);
185  }
static final int CALL_TYPE_SYNC
Definition: RemoteInvocationHandler.java:30
AbstractConnection conn
Definition: RemoteInvocationHandler.java:144
RemoteInvocationHandler(AbstractConnection conn, RemoteObject remote)
Definition: RemoteInvocationHandler.java:147
int hashCode()
Definition: RemoteObject.java:43
static Object executeRemoteMethod(RemoteObject ro, Method m, AbstractConnection conn, int syncmethod, CallbackHandler callback, Object... args)
Definition: RemoteInvocationHandler.java:76
boolean equals(Object o)
Definition: RemoteObject.java:26
RemoteObject remote
Definition: RemoteInvocationHandler.java:145
String toString()
Definition: RemoteObject.java:64

メンバ詳解

◆ CALL_TYPE_ASYNC

final int org.freedesktop.dbus.RemoteInvocationHandler.CALL_TYPE_ASYNC = 1
static

◆ CALL_TYPE_CALLBACK

final int org.freedesktop.dbus.RemoteInvocationHandler.CALL_TYPE_CALLBACK = 2
static

◆ CALL_TYPE_SYNC

final int org.freedesktop.dbus.RemoteInvocationHandler.CALL_TYPE_SYNC = 0
static

◆ conn

AbstractConnection org.freedesktop.dbus.RemoteInvocationHandler.conn
package

◆ remote

RemoteObject org.freedesktop.dbus.RemoteInvocationHandler.remote
package

このクラス詳解は次のファイルから抽出されました: