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

クラス

class  TreeNode
 

公開メンバ関数

 ObjectTree ()
 
void add (String path, ExportedObject object, String data)
 
void remove (String path)
 
String Introspect (String path)
 
String toString ()
 

静的公開変数類

static final Pattern slashpattern = Pattern.compile("/")
 

非公開メンバ関数

TreeNode recursiveFind (TreeNode current, String path)
 
TreeNode recursiveAdd (TreeNode current, String path, ExportedObject object, String data)
 
String recursivePrint (TreeNode current)
 

非公開変数類

TreeNode root
 

詳解

Keeps track of the exported objects for introspection data

構築子と解体子

◆ ObjectTree()

org.freedesktop.dbus.ObjectTree.ObjectTree ( )
inline
41  {
42  root = new TreeNode("");
43  }
TreeNode root
Definition: ObjectTree.java:39

関数詳解

◆ add()

void org.freedesktop.dbus.ObjectTree.add ( String  path,
ExportedObject  object,
String  data 
)
inline
110  {
111  if (Debug.debug) Debug.print(Debug.DEBUG, "Adding " + path + " to object tree");
112  root = recursiveAdd(root, path, object, data);
113  }
TreeNode root
Definition: ObjectTree.java:39
TreeNode recursiveAdd(TreeNode current, String path, ExportedObject object, String data)
Definition: ObjectTree.java:73

◆ Introspect()

String org.freedesktop.dbus.ObjectTree.Introspect ( String  path)
inline
122  {
123  TreeNode t = recursiveFind(root, path);
124  if (null == t) return null;
125  StringBuilder sb = new StringBuilder();
126  sb.append("<node name=\"");
127  sb.append(path);
128  sb.append("\">\n");
129  if (null != t.data) sb.append(t.data);
130  t = t.down;
131  while (null != t) {
132  sb.append("<node name=\"");
133  sb.append(t.name);
134  sb.append("\"/>\n");
135  t = t.right;
136  }
137  sb.append("</node>");
138  return sb.toString();
139  }
TreeNode root
Definition: ObjectTree.java:39
TreeNode recursiveFind(TreeNode current, String path)
Definition: ObjectTree.java:47

◆ recursiveAdd()

TreeNode org.freedesktop.dbus.ObjectTree.recursiveAdd ( TreeNode  current,
String  path,
ExportedObject  object,
String  data 
)
inlineprivate
73  {
74  String[] elements = slashpattern.split(path, 2);
75  // this is us or a parent node
76  if (path.startsWith(current.name)) {
77  // this is us
78  if (1 == elements.length || "".equals(elements[1])) {
79  current.object = object;
80  current.data = data;
81  }
82  // recurse down
83  else {
84  if (current.down == null) {
85  String[] el = elements[1].split("/", 2);
86  current.down = new TreeNode(el[0]);
87  }
88  current.down = recursiveAdd(current.down, elements[1], object, data);
89  }
90  }
91  // need to create a new sub-tree on the end
92  else if (current.right == null) {
93  current.right = new TreeNode(elements[0]);
94  current.right = recursiveAdd(current.right, path, object, data);
95  }
96  // need to insert here
97  else if (0 > current.right.name.compareTo(elements[0])) {
98  TreeNode t = new TreeNode(elements[0]);
99  t.right = current.right;
100  current.right = t;
101  current.right = recursiveAdd(current.right, path, object, data);
102  }
103  // recurse right
104  else {
105  current.right = recursiveAdd(current.right, path, object, data);
106  }
107  return current;
108  }
TreeNode recursiveAdd(TreeNode current, String path, ExportedObject object, String data)
Definition: ObjectTree.java:73
static final Pattern slashpattern
Definition: ObjectTree.java:45

◆ recursiveFind()

TreeNode org.freedesktop.dbus.ObjectTree.recursiveFind ( TreeNode  current,
String  path 
)
inlineprivate
47  {
48  if ("/".equals(path)) return current;
49  String[] elements = path.split("/", 2);
50  // this is us or a parent node
51  if (path.startsWith(current.name)) {
52  // this is us
53  if (path.equals(current.name)) {
54  return current;
55  }
56  // recurse down
57  else {
58  if (current.down == null)
59  return null;
60  else return recursiveFind(current.down, elements[1]);
61  }
62  } else if (current.right == null) {
63  return null;
64  } else if (0 > current.right.name.compareTo(elements[0])) {
65  return null;
66  }
67  // recurse right
68  else {
69  return recursiveFind(current.right, path);
70  }
71  }
TreeNode recursiveFind(TreeNode current, String path)
Definition: ObjectTree.java:47

◆ recursivePrint()

String org.freedesktop.dbus.ObjectTree.recursivePrint ( TreeNode  current)
inlineprivate
141  {
142  String s = "";
143  if (null != current) {
144  s += current.name;
145  if (null != current.object)
146  s += "*";
147  if (null != current.down)
148  s += "/{" + recursivePrint(current.down) + "}";
149  if (null != current.right)
150  s += ", " + recursivePrint(current.right);
151  }
152  return s;
153  }
String recursivePrint(TreeNode current)
Definition: ObjectTree.java:141

◆ remove()

void org.freedesktop.dbus.ObjectTree.remove ( String  path)
inline
115  {
116  if (Debug.debug) Debug.print(Debug.DEBUG, "Removing " + path + " from object tree");
117  TreeNode t = recursiveFind(root, path);
118  t.object = null;
119  t.data = null;
120  }
TreeNode root
Definition: ObjectTree.java:39
TreeNode recursiveFind(TreeNode current, String path)
Definition: ObjectTree.java:47

◆ toString()

String org.freedesktop.dbus.ObjectTree.toString ( )
inline
155  {
156  return recursivePrint(root);
157  }
String recursivePrint(TreeNode current)
Definition: ObjectTree.java:141
TreeNode root
Definition: ObjectTree.java:39

メンバ詳解

◆ root

TreeNode org.freedesktop.dbus.ObjectTree.root
private

◆ slashpattern

final Pattern org.freedesktop.dbus.ObjectTree.slashpattern = Pattern.compile("/")
static

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