@SuppressWarnings("unchecked")
protected BindingTemplate parseServiceBinding(Class classWithAnnotations, String lang,
WebService webServiceAnnotation, Properties properties) {
BindingTemplate bindingTemplate = null;
UDDIServiceBinding uddiServiceBinding= (UDDIServiceBinding) classWithAnnotations.getAnnotation(UDDIServiceBinding.class);
//binding
if (uddiServiceBinding!=null) {
bindingTemplate = new BindingTemplate();
bindingTemplate.setBindingKey(TokenResolver.replaceTokens(uddiServiceBinding.bindingKey(), properties));
String bindingLang = String.valueOf(lang);
if (uddiServiceBinding.lang()!=null) {
bindingLang = TokenResolver.replaceTokens(uddiServiceBinding.lang(),properties);
}
Description bindingDescription = new Description();
bindingDescription.setLang(bindingLang);
bindingDescription.setValue(TokenResolver.replaceTokens(uddiServiceBinding.description(),properties));
bindingTemplate.getDescription().add(bindingDescription);
AccessPoint accessPoint = new AccessPoint();
accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
if (!"".equals(uddiServiceBinding.accessPointType())) {
accessPoint.setUseType(uddiServiceBinding.accessPointType());
}
if (!"".equals(uddiServiceBinding.accessPoint())) {
String endPoint = uddiServiceBinding.accessPoint();
endPoint = TokenResolver.replaceTokens(endPoint, properties);
log.debug("AccessPoint EndPoint=" + endPoint);
accessPoint.setValue(endPoint);
} else if (webServiceAnnotation!=null && webServiceAnnotation.wsdlLocation()!=null) {
accessPoint.setValue(webServiceAnnotation.wsdlLocation());
}
bindingTemplate.setAccessPoint(accessPoint);
//tModelKeys on the binding
if (!"".equals(uddiServiceBinding.tModelKeys())) {
String[] tModelKeys= uddiServiceBinding.tModelKeys().split(",");
for (String tModelKey : tModelKeys) {
TModelInstanceInfo instanceInfo = new TModelInstanceInfo();
instanceInfo.setTModelKey(tModelKey);
if (bindingTemplate.getTModelInstanceDetails()==null) {
bindingTemplate.setTModelInstanceDetails(new TModelInstanceDetails());
}
bindingTemplate.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo);
}
}
//categoryBag on the binding
if (!"".equals(uddiServiceBinding.categoryBag())) {
CategoryBag categoryBag = parseCategoryBag(uddiServiceBinding.categoryBag());
bindingTemplate.setCategoryBag(categoryBag);
}
} else {
log.error("Missing UDDIServiceBinding annotation in class " + classWithAnnotations);
}
return bindingTemplate;