throw new RegistryException(msg);
}
}
public TaggedResourcePath[] getResourcePathsWithTag(String tag) throws RegistryException {
AbderaClient abderaClient = new AbderaClient(abdera);
ClientResponse clientResponse = abderaClient.get(baseURI + "/tags/" + tag,
getAuthorization());
Document introspection =
clientResponse.getDocument();
Feed feed = (Feed) introspection.getRoot();
List entries = feed.getEntries();
TaggedResourcePath taggedResourcePaths[] = null;
if (entries != null) {
taggedResourcePaths = new TaggedResourcePath[entries.size()];
for (int i = 0; i < entries.size(); i++) {
Entry entry = (Entry) entries.get(i);
org.wso2.carbon.registry.app.Properties properties =
entry.getExtension(PropertyExtensionFactory.TAGS);
List propertyList = properties.getExtensions(PropertyExtensionFactory.TAG);
Map<String, String> map = new HashMap<String, String>();
for (Object aPropertyList : propertyList) {
Property property = (Property) aPropertyList;
PropertyName pn = property.getExtension(PropertyExtensionFactory.PROPERTY_NAME);
PropertyValue pv =
property.getExtension(PropertyExtensionFactory.PROPERTY_VALUE);
map.put(pn.getText(), pv.getText());
}
TaggedResourcePath tagPath = new TaggedResourcePath();
tagPath.setResourcePath(entry.getTitle());
tagPath.setTagCount(
Long.parseLong(entry.getSimpleExtension(new QName(APPConstants.NAMESPACE,
"taggings"))));
taggedResourcePaths[i] = tagPath;
tagPath.setTagCounts(map);
}
}
abderaClient.teardown();
return taggedResourcePaths;
}