if (this.xregistryClient == null) {
connect();
}
try {
ComponentTreeNode tree = new ComponentTreeNode(this);
List<QName> qnames = new ArrayList<QName>();
if (this.type == Type.CONCRETE) {
// "" returns all CWSDLs.
WsdlData[] datas = this.xregistryClient.findServiceInstance("");
if (datas != null) {
for (WsdlData wsdlData : datas) {
qnames.add(wsdlData.getName());
}
}
} else {
ServiceDescData[] datas = this.xregistryClient.findServiceDesc("");
if (datas != null) {
for (ServiceDescData wsdlData : datas) {
qnames.add(wsdlData.getName());
}
}
}
Map<String, ComponentTreeNode> namespaceMap = new HashMap<String, ComponentTreeNode>();
for (QName qname : qnames) {
logger.finest("qname: " + qname);
XRegistryComponentReference componentRef = new XRegistryComponentReference(
this, qname);
String namespace = qname.getNamespaceURI();
ComponentTreeNode namespaceNode = namespaceMap.get(namespace);
if (namespaceNode == null) {
namespaceNode = new ComponentTreeNode(namespace);
namespaceMap.put(namespace, namespaceNode);
tree.add(namespaceNode);
}
ComponentTreeNode treeLeaf = new ComponentTreeNode(componentRef);
namespaceNode.add(treeLeaf);
}
return tree;
} catch (XRegistryClientException e) {
throw new ComponentRegistryException(e);