- Common ways to obtain Destination
private void myMethod () {Destination d =
Service service;String id;service.findDestinationById(id)
- Smart code suggestions by Codota
}
log.debug(">> No cached factory for: %s", adapterId); Adapter config = destination.getAdapter(); try { Class<? extends ServiceAdapter> clazz = (adapterId != null) log.debug(">> Found a cached serviceAdapter for ref: %s", destination.getAdapter());
public ServiceAdapter getServiceAdapter(String messageType, String destinationId) throws ServiceException { GraniteContext context = GraniteContext.getCurrentInstance(); log.debug(">> Finding serviceAdapter for messageType: %s and destinationId: %s", messageType, destinationId); ServicesConfig servicesConfig = context.getServicesConfig(); Destination destination = servicesConfig.findDestinationById(messageType, destinationId); if (destination == null) { log.debug(">> No destination found: %s", destinationId); return null; } Adapter adapter = destination.getAdapter(); String key = null; if (adapter != null) { log.debug(">> Found adapterRef: %s", adapter.getId()); key = AdapterFactory.class.getName() + '@' + destination.getId() + '.' + adapter.getId(); } else key = defaultAdapterClass.getName() + '@' + destination.getId(); return getServiceAdapter(adaptersCache, context, destination, key, adapter != null ? adapter.getId() : null); }