keycloak-federation
公開メンバ関数 | 変数 | 非公開メンバ関数 | 全メンバ一覧
org.freedesktop.dbus.ExportedObject クラス
org.freedesktop.dbus.ExportedObject 連携図
Collaboration graph

公開メンバ関数

 ExportedObject (DBusInterface object, boolean weakreferences) throws DBusException
 

変数

Map< MethodTuple, Method > methods
 
Reference< DBusInterfaceobject
 
String introspectiondata
 

非公開メンバ関数

String getAnnotations (AnnotatedElement c)
 
Map< MethodTuple, Method > getExportedMethods (Class c) throws DBusException
 

詳解

構築子と解体子

◆ ExportedObject()

org.freedesktop.dbus.ExportedObject.ExportedObject ( DBusInterface  object,
boolean  weakreferences 
) throws DBusException
inline
144  {
145  if (weakreferences)
146  this.object = new WeakReference<DBusInterface>(object);
147  else
148  this.object = new StrongReference<DBusInterface>(object);
149  introspectiondata = "";
150  methods = getExportedMethods(object.getClass());
151  introspectiondata +=
152  " <interface name=\"org.freedesktop.DBus.Introspectable\">\n" +
153  " <method name=\"Introspect\">\n" +
154  " <arg type=\"s\" direction=\"out\"/>\n" +
155  " </method>\n" +
156  " </interface>\n";
157  introspectiondata +=
158  " <interface name=\"org.freedesktop.DBus.Peer\">\n" +
159  " <method name=\"Ping\">\n" +
160  " </method>\n" +
161  " </interface>\n";
162  }
Map< MethodTuple, Method > getExportedMethods(Class c)
Definition: ExportedObject.java:52
Reference< DBusInterface > object
Definition: ExportedObject.java:141
Map< MethodTuple, Method > methods
Definition: ExportedObject.java:140
String introspectiondata
Definition: ExportedObject.java:142

関数詳解

◆ getAnnotations()

String org.freedesktop.dbus.ExportedObject.getAnnotations ( AnnotatedElement  c)
inlineprivate
33  {
34  String ans = "";
35  for (Annotation a : c.getDeclaredAnnotations()) {
36  Class t = a.annotationType();
37  String value = "";
38  try {
39  Method m = t.getMethod("value");
40  value = m.invoke(a).toString();
41  } catch (NoSuchMethodException NSMe) {
42  } catch (InvocationTargetException ITe) {
43  } catch (IllegalAccessException IAe) {
44  }
45 
46  ans += " <annotation name=\"" + AbstractConnection.dollar_pattern.matcher(t.getName()).replaceAll(".") + "\" value=\"" + value + "\" />\n";
47  }
48  return ans;
49  }

◆ getExportedMethods()

Map<MethodTuple, Method> org.freedesktop.dbus.ExportedObject.getExportedMethods ( Class  c) throws DBusException
inlineprivate
52  {
53  if (DBusInterface.class.equals(c)) return new HashMap<MethodTuple, Method>();
54  Map<MethodTuple, Method> m = new HashMap<MethodTuple, Method>();
55  for (Class i : c.getInterfaces())
56  if (DBusInterface.class.equals(i)) {
57  // add this class's public methods
58  if (null != c.getAnnotation(DBusInterfaceName.class)) {
59  String name = ((DBusInterfaceName) c.getAnnotation(DBusInterfaceName.class)).value();
60  introspectiondata += " <interface name=\"" + name + "\">\n";
61  DBusSignal.addInterfaceMap(c.getName(), name);
62  } else {
63  // don't let people export things which don't have a
64  // valid D-Bus interface name
65  if (c.getName().equals(c.getSimpleName()))
66  throw new DBusException(getString("interfaceNotAllowedOutsidePackage"));
67  if (c.getName().length() > DBusConnection.MAX_NAME_LENGTH)
68  throw new DBusException(getString("introspectInterfaceExceedCharacters") + c.getName());
69  else
70  introspectiondata += " <interface name=\"" + AbstractConnection.dollar_pattern.matcher(c.getName()).replaceAll(".") + "\">\n";
71  }
73  for (Method meth : c.getDeclaredMethods())
74  if (Modifier.isPublic(meth.getModifiers())) {
75  String ms = "";
76  String name;
77  if (meth.isAnnotationPresent(DBusMemberName.class))
78  name = meth.getAnnotation(DBusMemberName.class).value();
79  else
80  name = meth.getName();
81  if (name.length() > DBusConnection.MAX_NAME_LENGTH)
82  throw new DBusException(getString("introspectMethodExceedCharacters") + name);
83  introspectiondata += " <method name=\"" + name + "\" >\n";
85  for (Class ex : meth.getExceptionTypes())
86  if (DBusExecutionException.class.isAssignableFrom(ex))
88  " <annotation name=\"org.freedesktop.DBus.Method.Error\" value=\"" + AbstractConnection.dollar_pattern.matcher(ex.getName()).replaceAll(".") + "\" />\n";
89  for (Type pt : meth.getGenericParameterTypes())
90  for (String s : Marshalling.getDBusType(pt)) {
91  introspectiondata += " <arg type=\"" + s + "\" direction=\"in\"/>\n";
92  ms += s;
93  }
94  if (!Void.TYPE.equals(meth.getGenericReturnType())) {
95  if (Tuple.class.isAssignableFrom((Class) meth.getReturnType())) {
96  ParameterizedType tc = (ParameterizedType) meth.getGenericReturnType();
97  Type[] ts = tc.getActualTypeArguments();
98 
99  for (Type t : ts)
100  if (t != null)
101  for (String s : Marshalling.getDBusType(t))
102  introspectiondata += " <arg type=\"" + s + "\" direction=\"out\"/>\n";
103  } else if (Object[].class.equals(meth.getGenericReturnType())) {
104  throw new DBusException(getString("cannotIntrospectReturnType"));
105  } else
106  for (String s : Marshalling.getDBusType(meth.getGenericReturnType()))
107  introspectiondata += " <arg type=\"" + s + "\" direction=\"out\"/>\n";
108  }
109  introspectiondata += " </method>\n";
110  m.put(new MethodTuple(name, ms), meth);
111  }
112  for (Class sig : c.getDeclaredClasses())
113  if (DBusSignal.class.isAssignableFrom(sig)) {
114  String name;
115  if (sig.isAnnotationPresent(DBusMemberName.class)) {
116  name = ((DBusMemberName) sig.getAnnotation(DBusMemberName.class)).value();
117  DBusSignal.addSignalMap(sig.getSimpleName(), name);
118  } else
119  name = sig.getSimpleName();
120  if (name.length() > DBusConnection.MAX_NAME_LENGTH)
121  throw new DBusException(getString("introspectSignalExceedCharacters") + name);
122  introspectiondata += " <signal name=\"" + name + "\">\n";
123  Constructor con = sig.getConstructors()[0];
124  Type[] ts = con.getGenericParameterTypes();
125  for (int j = 1; j < ts.length; j++)
126  for (String s : Marshalling.getDBusType(ts[j]))
127  introspectiondata += " <arg type=\"" + s + "\" direction=\"out\" />\n";
129  introspectiondata += " </signal>\n";
130 
131  }
132  introspectiondata += " </interface>\n";
133  } else {
134  // recurse
135  m.putAll(getExportedMethods(i));
136  }
137  return m;
138  }
String getAnnotations(AnnotatedElement c)
Definition: ExportedObject.java:33
Map< MethodTuple, Method > getExportedMethods(Class c)
Definition: ExportedObject.java:52
String introspectiondata
Definition: ExportedObject.java:142

メンバ詳解

◆ introspectiondata

String org.freedesktop.dbus.ExportedObject.introspectiondata
package

◆ methods

Map<MethodTuple, Method> org.freedesktop.dbus.ExportedObject.methods
package

◆ object

Reference<DBusInterface> org.freedesktop.dbus.ExportedObject.object
package

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