return services;
}
public BusinessService readServiceAnnotations(String classWithAnnotations, Properties properties) throws ClassNotFoundException {
BusinessService service = new BusinessService();
Class<?> clazz = ClassUtil.forName(classWithAnnotations, this.getClass());
UDDIService uddiService= (UDDIService) clazz.getAnnotation(UDDIService.class);
WebService webServiceAnnotation = (WebService) clazz.getAnnotation(WebService.class);
if (uddiService!=null) {
//service
String lang = "en"; //default to english
if (uddiService.lang()!=null) {
lang = uddiService.lang();
}
Name name = new Name();
name.setLang(lang);
service.setBusinessKey(TokenResolver.replaceTokens(uddiService.businessKey(),properties));
service.setServiceKey(TokenResolver.replaceTokens(uddiService.serviceKey(),properties));
if (!"".equals(uddiService.serviceName())) {
name.setValue(TokenResolver.replaceTokens(uddiService.serviceName(),properties));
} else if (webServiceAnnotation!=null && !"".equals(webServiceAnnotation.serviceName())) {
name.setValue(webServiceAnnotation.serviceName());
} else {
name.setValue(clazz.getSimpleName());
}
service.getName().add(name);
Description description = new Description();
description.setLang(lang);
description.setValue(TokenResolver.replaceTokens(uddiService.description(),properties));
service.getDescription().add(description);
//categoryBag on the service
if (!"".equals(uddiService.categoryBag())) {
CategoryBag categoryBag = parseCategoryBag(uddiService.categoryBag());
service.setCategoryBag(categoryBag);
}
//bindingTemplate on service
BindingTemplate bindingTemplate = parseServiceBinding(clazz, lang, webServiceAnnotation, properties);
if (bindingTemplate!=null) {
bindingTemplate.setServiceKey(service.getServiceKey());
if (service.getBindingTemplates()==null) {
service.setBindingTemplates(new BindingTemplates());
}
service.getBindingTemplates().getBindingTemplate().add(bindingTemplate);
}
} else {
log.error("Missing UDDIService annotation in class " + classWithAnnotations);