@Override public String toString() { return "Service{" + "id=" + id + ", class=" + className + ", messageTypes=" + messageTypes + ", defaultAdapter=" + adapter.getId() + '}'; } }
public void addAdapter(Adapter adapter) { adapters.put(adapter.getId(), adapter); }
public void addAdapter(Adapter adapter) { adapters.put(adapter.getId(), adapter); }
@Override public String toString() { return "Destination{" + "id='" + id + '\'' + ", service='" + service.getId() + '\'' + ", adapter='" + adapter.getId() + '\'' + '}'; } }
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); }
public static Service forElement(XMap element) { String id = element.get("@id"); String className = element.get("@class"); String messageTypes = element.get("@messageTypes"); Adapter defaultAdapter = null; Map<String, Adapter> adaptersMap = new HashMap<String, Adapter>(); for (XMap adapter : element.getAll("adapters/adapter-definition")) { Adapter ad = Adapter.forElement(adapter); if (Boolean.TRUE.toString().equals(adapter.get("@default"))) defaultAdapter = ad; adaptersMap.put(ad.getId(), ad); } Map<String, Destination> destinations = new HashMap<String, Destination>(); for (XMap destinationElt : element.getAll("destination")) { Destination destination = Destination.forElement(destinationElt, defaultAdapter, adaptersMap); destinations.put(destination.getId(), destination); } return new Service(id, className, messageTypes, defaultAdapter, adaptersMap, destinations); } }
public static Service forElement(XMap element) { String id = element.get("@id"); String className = element.get("@class"); String messageTypes = element.get("@messageTypes"); Adapter defaultAdapter = null; Map<String, Adapter> adaptersMap = new HashMap<String, Adapter>(); for (XMap adapter : element.getAll("adapters/adapter-definition")) { Adapter ad = Adapter.forElement(adapter); if (Boolean.TRUE.toString().equals(adapter.get("@default"))) defaultAdapter = ad; adaptersMap.put(ad.getId(), ad); } Map<String, Destination> destinations = new HashMap<String, Destination>(); for (XMap destinationElt : element.getAll("destination")) { Destination destination = Destination.forElement(destinationElt, defaultAdapter, adaptersMap); destinations.put(destination.getId(), destination); } return new Service(id, className, messageTypes, defaultAdapter, adaptersMap, destinations); } }
adapter = buildAdapter(); Map<String, Adapter> adapters = new HashMap<String, Adapter>(); adapters.put(adapter.getId(), adapter); service = new Service("gravity-service", "flex.messaging.services.MessagingService", "flex.messaging.messages.AsyncMessage", adapter, adapters, new HashMap<String, Destination>()); service = services.get(0); Adapter ad = buildAdapter(); adapter = service.findAdapterById(ad.getId()); if (adapter == null) { adapter = ad;