public void addChannel(Channel channel) { channels.put(channel.getId(), channel); }
@Override public boolean getChannelProperty(String channelId, String propertyName) { if (channelId == null) return false; Channel channel = findChannelById(channelId); if (channel == null) { log.debug("Could not get channel for channel id: %s", channelId); return false; } if ("legacyXmlSerialization".equals(propertyName)) return channel.isLegacyXmlSerialization(); else if ("legacyCollectionSerialization".equals(propertyName)) return channel.isLegacyCollectionSerialization(); return false; }
if (channels != null) { for (XMap channel : channels.getAll("channel-definition")) { Channel chan = Channel.forElement(channel); this.channels.put(chan.getId(), chan); log.info("No channel definition found, using defaults"); EndPoint defaultEndpoint = new EndPoint("http://{server.name}:{server.port}/{context.root}/graniteamf/amf", "flex.messaging.endpoints.AMFEndpoint"); Channel defaultChannel = new Channel("my-graniteamf", "mx.messaging.channels.AMFChannel", defaultEndpoint, XMap.EMPTY_XMAP); this.channels.put(defaultChannel.getId(), defaultChannel);
public static Channel forElement(XMap element) { String id = element.get("@id"); String className = element.get("@class"); XMap endPointElt = element.getOne("endpoint"); if (endPointElt == null) throw new RuntimeException("Excepting a 'endpoint' element in 'channel-definition': " + id); EndPoint endPoint = EndPoint.forElement(endPointElt); XMap properties = new XMap(element.getOne("properties")); return new Channel(id, className, endPoint, properties); } }
protected void writeAMF3Collection(Collection<?> c) throws IOException { if (debugMore) logMore.debug("writeAMF3Collection(c=%s)", c); Channel channel = getChannel(); if (channel != null && channel.isLegacyCollectionSerialization()) writeAMF3Array(c.toArray()); else { ArrayCollection ac = (c instanceof ArrayCollection ? (ArrayCollection)c : new ArrayCollection(c)); writeAMF3Object(ac); } }
protected void writeAMF3Xml(Document doc) throws IOException { if (debugMore) logMore.debug("writeAMF3Xml(doc=%s)", doc); byte xmlType = AMF3_XMLSTRING; Channel channel = getChannel(); if (channel != null && channel.isLegacyXmlSerialization()) xmlType = AMF3_XML; write(xmlType); int index = indexOfStoredObjects(doc); if (index >= 0) writeAMF3IntegerData(index << 1); else { addToStoredObjects(doc); byte[] bytes = xmlUtil.toString(doc).getBytes("UTF-8"); writeAMF3IntegerData((bytes.length << 1) | 0x01); write(bytes); } }
if (channels != null) { for (XMap channel : channels.getAll("channel-definition")) { Channel chan = Channel.forElement(channel); this.channels.put(chan.getId(), chan); log.info("No channel definition found, using defaults"); EndPoint defaultEndpoint = new EndPoint("http://{server.name}:{server.port}/{context.root}/graniteamf/amf", "flex.messaging.endpoints.AMFEndpoint"); Channel defaultChannel = new Channel("my-graniteamf", "mx.messaging.channels.AMFChannel", defaultEndpoint, XMap.EMPTY_XMAP); this.channels.put(defaultChannel.getId(), defaultChannel);
public static Channel forElement(XMap element) { String id = element.get("@id"); String className = element.get("@class"); XMap endPointElt = element.getOne("endpoint"); if (endPointElt == null) throw new RuntimeException("Excepting a 'endpoint' element in 'channel-definition': " + id); EndPoint endPoint = EndPoint.forElement(endPointElt); XMap properties = new XMap(element.getOne("properties")); return new Channel(id, className, endPoint, properties); } }
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); }
public void addChannel(Channel channel) { channels.put(channel.getId(), channel); }
public void initServices(ServicesConfig servicesConfig) { Channel channel = servicesConfig.findChannelById("gravityamf"); if (channel == null) { channel = new Channel("gravityamf", "org.granite.gravity.channels.GravityChannel", new EndPoint("http://{server.name}:{server.port}/{context.root}/gravityamf/amf", "flex.messaging.endpoints.AMFEndpoint"), new XMap());
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());