{
final Collection currentBindings ;
try {
currentBindings = service.getServiceBindings() ;
} catch (final JAXRException jaxre) {
throw new RegistryException(jaxre.getLocalizedMessage(), jaxre);
}
if ((currentBindings != null) && (currentBindings.size() > 0)) {
return currentBindings;
}
Collection<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
Connection connection = JAXRConnectionSingleton.getConnection(jaxrConnectionFactory);
try {
final Concept jbossTModel = getJBossESBTModel(connection);
RegistryService rs = connection.getRegistryService();
BusinessQueryManager bqm = rs.getBusinessQueryManager();
BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
Collection<String> findQualifiers = null;
//Collection<String> findQualifiers = new ArrayList<String>();
//findQualifiers.add(FindQualifier.SORT_BY_DATE_ASC);
ArrayList<SpecificationLink> specs = new ArrayList<SpecificationLink>();
SpecificationLink sl = new SpecificationLinkImpl(blm);
sl.setSpecificationObject(jbossTModel);
specs.add(sl);
BulkResponse bulkResponse = bqm.findServiceBindings(service.getKey(),findQualifiers,null,specs);
if (bulkResponse.getStatus()==JAXRResponse.STATUS_SUCCESS){
serviceBindings = (Collection<ServiceBinding>)bulkResponse.getCollection();
for (Iterator bindIter = serviceBindings.iterator(); bindIter.hasNext();)
{
ServiceBinding binding = (ServiceBinding) bindIter.next();
Collection<SpecificationLink> bindingSpecs = binding.getSpecificationLinks();
SpecificationLink slink = new SpecificationLinkImpl(blm);
slink.setSpecificationObject(jbossTModel);
bindingSpecs.add(slink);
}
}
return serviceBindings;
} catch (Exception je) {
throw new RegistryException(je.getLocalizedMessage(), je);
} finally {
JAXRConnectionSingleton.recycleConnection(jaxrConnectionFactory, connection);
}
}