private static void extractConnectorMetadata(final BeanDefinition bd) {
String beanClassName = bd.getBeanClassName();
String connectorName = getConnectorName(beanClassName);
Connector connector = new Connector();
connector.updaterClass = getUpdaterClass(beanClassName);
Updater updaterAnnotation = connector.updaterClass
.getAnnotation(Updater.class);
// set connectors' pretty name
connector.prettyName = updaterAnnotation.prettyName();
connector.deviceNickname = updaterAnnotation.deviceNickname().equals(Updater.DEVICE_NICKNAME_NONE)
? updaterAnnotation.prettyName()==null ? connectorName : updaterAnnotation.prettyName()
: updaterAnnotation.deviceNickname();
connector.value = updaterAnnotation.value();
connector.updateStrategyType = updaterAnnotation
.updateStrategyType();
connector.hasFacets = updaterAnnotation.hasFacets();
connector.name = connectorName;
connector.sharedConnectorFilterClass = updaterAnnotation.sharedConnectorFilter();
connector.deleteOrder = updaterAnnotation.deleteOrder();
// set connectors' object types
Class<? extends AbstractFacet>[] facetTypes = updaterAnnotation
.objectTypes();
if (updaterAnnotation.extractor() != AbstractFacetExtractor.class)
connector.extractorClass = updaterAnnotation.extractor();
if (facetTypes.length == 1) {
connector.facetClass = facetTypes[0];
}
if (updaterAnnotation.userProfile() != AbstractUserProfile.class)
connector.userProfileClass = updaterAnnotation
.userProfile();
connector.defaultChannels = updaterAnnotation.defaultChannels();
List<ObjectType> connectorObjectTypes = new ArrayList<ObjectType>();
for (Class<? extends AbstractFacet> facetType : facetTypes) {
final ObjectType objectType = getFacetTypeMetadata(connector, facetTypes, facetType);
connectorObjectTypes.add(objectType);
ObjectType.addObjectType(objectType.name(), connector, objectType);
}
if (connectorObjectTypes.size()>0)
connector.objectTypes = connectorObjectTypes.toArray(new ObjectType[0]);
connectors.put(connectorName, connector);
connectorsByValue.put(connector.value(), connector);
connectorsByDeviceNickname.put(connector.deviceNickname, connector);
if (connector.prettyName != null) {
connectorsByPrettyName.put(connector.prettyName.toLowerCase(), connector);
}
connector.bodytrackResponder = updaterAnnotation.bodytrackResponder();
}