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); } }
public void initServices(ServicesConfig servicesConfig) { Channel channel = servicesConfig.findChannelById("graniteamf"); if (channel == null) { channel = new Channel("graniteamf", "mx.messaging.channels.AMFChannel", new EndPoint("http://{server.name}:{server.port}/{context.root}/graniteamf/amf", "flex.messaging.endpoints.AMFEndpoint"), new XMap()); servicesConfig.addChannel(channel); } List<Service> services = servicesConfig.findServicesByMessageType("flex.messaging.messages.RemotingMessage"); Service service = null; if (services == null || services.isEmpty()) { service = new Service("granite-service", "flex.messaging.services.RemotingService", "flex.messaging.messages.RemotingMessage", null, null, new HashMap<String, Destination>()); servicesConfig.addService(service); } else service = services.get(0); service.getDestinations().put(source, buildDestination()); log.info("Registered remote destination %s", source); }
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>()); servicesConfig.addService(service);
service = new Service("granite-service", "flex.messaging.services.RemotingService", "flex.messaging.messages.RemotingMessage", null, null, new HashMap<String, Destination>()); List<String> channelIds = new ArrayList<String>(); servicesConfig.addFactory(factory); Service service = new Service("granite-service", "flex.messaging.services.RemotingService", "flex.messaging.messages.RemotingMessage", null, null, new HashMap<String, Destination>()); servicesConfig.addService(service);