int attrCount = serviceItem.attributeSets.length;
Entry[] attr = serviceItem.attributeSets;
List<UIDescriptor> list = new ArrayList<UIDescriptor>();
for(int i = 0; i < attrCount; ++i) {
if(attr[i] instanceof UIDescriptor) {
UIDescriptor desc = (UIDescriptor)attr[i];
if(desc.attributes == null) {
continue;
}
if(!desc.role.equals(role)) {
continue;
}
for (Object attribute : desc.attributes) {
if (attribute instanceof UIFactoryTypes) {
UIFactoryTypes factoryTypes =
(UIFactoryTypes) attribute;
boolean found;
found = factoryTypes.isAssignableTo(
JComponentFactory.class);
if (found) {
// Should also look through required packages
// here
list.add(desc);
}
}
}
}
}
List factoryList = new ArrayList();
for (UIDescriptor desc : list) {
Object uiFactory;
try {
uiFactory =
desc.getUIFactory(serviceItem.service
.getClass().getClassLoader());
if (uiFactory instanceof JComponentFactory)
factoryList.add(uiFactory);
} catch (ClassNotFoundException e) {
System.out.println(