private Map<String, Object> createBackupMap() { Map<String, Object> backupMap = new HashMap<String, Object>(); backupMap.putAll(packet.createMapView()); Set<String> handlerProps = packet.getHandlerScopePropertyNames(true); for(Map.Entry<String, Object> e : packet.invocationProperties.entrySet()) { if (!handlerProps.contains(e.getKey())) { backupMap.put(e.getKey(), e.getValue()); } } return backupMap; }
/** Creates a new instance of MessageContextImpl */ public MessageContextImpl(Packet packet) { this.packet = packet; this.asMapIncludingInvocationProperties = packet.asMapIncludingInvocationProperties(); this.handlerScopeProps = packet.getHandlerScopePropertyNames(false); }
/** Creates a new instance of MessageContextImpl */ public MessageContextImpl(Packet packet) { this.packet = packet; this.asMapIncludingInvocationProperties = packet.asMapIncludingInvocationProperties(); this.handlerScopeProps = packet.getHandlerScopePropertyNames(false); }
private Map<String, Object> createBackupMap() { Map<String, Object> backupMap = new HashMap<String, Object>(); backupMap.putAll(packet.createMapView()); Set<String> handlerProps = packet.getHandlerScopePropertyNames(true); for(Map.Entry<String, Object> e : packet.invocationProperties.entrySet()) { if (!handlerProps.contains(e.getKey())) { backupMap.put(e.getKey(), e.getValue()); } } return backupMap; }
/** Creates a new instance of MessageContextImpl */ public MessageContextImpl(Packet packet) { this.packet = packet; this.asMapIncludingInvocationProperties = packet.asMapIncludingInvocationProperties(); this.handlerScopeProps = packet.getHandlerScopePropertyNames(false); }
private Map<String, Object> createBackupMap() { Map<String, Object> backupMap = new HashMap<String, Object>(); backupMap.putAll(packet.createMapView()); Set<String> handlerProps = packet.getHandlerScopePropertyNames(true); for(Map.Entry<String, Object> e : packet.invocationProperties.entrySet()) { if (!handlerProps.contains(e.getKey())) { backupMap.put(e.getKey(), e.getValue()); } } return backupMap; }
public Set<Entry<String, Object>> entrySet() { if(entrySet==null) { // this is where the worst case happens. we have to clone the whole properties // to get this view. // use TreeSet so that toString() sort them nicely. It's easier for apps. Map<String,Object> r = new HashMap<String,Object>(); // export application-scope properties r.putAll(packet.invocationProperties); // hide handler-scope properties r.keySet().removeAll(packet.getHandlerScopePropertyNames(true)); // and all strongly typed ones r.putAll(packet.createMapView()); entrySet = Collections.unmodifiableSet(r.entrySet()); } return entrySet; }
public Set<Entry<String, Object>> entrySet() { if(entrySet==null) { // this is where the worst case happens. we have to clone the whole properties // to get this view. // use TreeSet so that toString() sort them nicely. It's easier for apps. Map<String,Object> r = new HashMap<String,Object>(); // export application-scope properties r.putAll(packet.invocationProperties); // hide handler-scope properties r.keySet().removeAll(packet.getHandlerScopePropertyNames(true)); // and all strongly typed ones r.putAll(packet.createMapView()); entrySet = Collections.unmodifiableSet(r.entrySet()); } return entrySet; }
public Set<Entry<String, Object>> entrySet() { if(entrySet==null) { // this is where the worst case happens. we have to clone the whole properties // to get this view. // use TreeSet so that toString() sort them nicely. It's easier for apps. Map<String,Object> r = new HashMap<String,Object>(); // export application-scope properties r.putAll(packet.invocationProperties); // hide handler-scope properties r.keySet().removeAll(packet.getHandlerScopePropertyNames(true)); // and all strongly typed ones r.putAll(packet.createMapView()); entrySet = Collections.unmodifiableSet(r.entrySet()); } return entrySet; }
public boolean containsKey(Object key) { if(packet.supports(key)) return packet.containsKey(key); // strongly typed if(packet.invocationProperties.containsKey(key)) // if handler-scope, hide it return !packet.getHandlerScopePropertyNames(true).contains(key); return false; }
public boolean containsKey(Object key) { if(packet.supports(key)) return packet.containsKey(key); // strongly typed if(packet.invocationProperties.containsKey(key)) // if handler-scope, hide it return !packet.getHandlerScopePropertyNames(true).contains(key); return false; }
public boolean containsKey(Object key) { if(packet.supports(key)) return packet.containsKey(key); // strongly typed if(packet.invocationProperties.containsKey(key)) // if handler-scope, hide it return !packet.getHandlerScopePropertyNames(true).contains(key); return false; }
@Override public Object put(String key, Object value) { if (packet.supports(key)) { return packet.put(key, value); // strongly typed } Object old = packet.invocationProperties.get(key); if (old != null) { if (packet.getHandlerScopePropertyNames(true).contains(key)) { throw new IllegalArgumentException("Cannot overwrite property in HANDLER scope"); } // Overwrite existing APPLICATION scoped property packet.invocationProperties.put(key, value); return old; } // No existing property. So Add a new property packet.invocationProperties.put(key, value); return null; }
@Override public Object put(String key, Object value) { if (packet.supports(key)) { return packet.put(key, value); // strongly typed } Object old = packet.invocationProperties.get(key); if (old != null) { if (packet.getHandlerScopePropertyNames(true).contains(key)) { throw new IllegalArgumentException("Cannot overwrite property in HANDLER scope"); } // Overwrite existing APPLICATION scoped property packet.invocationProperties.put(key, value); return old; } // No existing property. So Add a new property packet.invocationProperties.put(key, value); return null; }
@Override @SuppressWarnings("element-type-mismatch") public Object remove(Object key) { if (packet.supports(key)) { return packet.remove(key); } Object old = packet.invocationProperties.get(key); if (old != null) { if (packet.getHandlerScopePropertyNames(true).contains(key)) { throw new IllegalArgumentException("Cannot remove property in HANDLER scope"); } // Remove existing APPLICATION scoped property packet.invocationProperties.remove(key); return old; } // No existing property. return null; }
@Override public Object put(String key, Object value) { if (packet.supports(key)) { return packet.put(key, value); // strongly typed } Object old = packet.invocationProperties.get(key); if (old != null) { if (packet.getHandlerScopePropertyNames(true).contains(key)) { throw new IllegalArgumentException("Cannot overwrite property in HANDLER scope"); } // Overwrite existing APPLICATION scoped property packet.invocationProperties.put(key, value); return old; } // No existing property. So Add a new property packet.invocationProperties.put(key, value); return null; }
@Override @SuppressWarnings("element-type-mismatch") public Object remove(Object key) { if (packet.supports(key)) { return packet.remove(key); } Object old = packet.invocationProperties.get(key); if (old != null) { if (packet.getHandlerScopePropertyNames(true).contains(key)) { throw new IllegalArgumentException("Cannot remove property in HANDLER scope"); } // Remove existing APPLICATION scoped property packet.invocationProperties.remove(key); return old; } // No existing property. return null; }
public Object get(Object key) { if(packet.supports(key)) return packet.get(key); // strongly typed if(packet.getHandlerScopePropertyNames(true).contains(key)) return null; // no such application-scope property Object value = packet.invocationProperties.get(key); //add the attachments from the Message to the corresponding attachment property if(key.equals(MessageContext.INBOUND_MESSAGE_ATTACHMENTS)){ Map<String, DataHandler> atts = (Map<String, DataHandler>) value; if(atts == null) atts = new HashMap<String, DataHandler>(); AttachmentSet attSet = packet.getMessage().getAttachments(); for(Attachment att : attSet){ atts.put(att.getContentId(), att.asDataHandler()); } return atts; } return value; }
public Object get(Object key) { if(packet.supports(key)) return packet.get(key); // strongly typed if(packet.getHandlerScopePropertyNames(true).contains(key)) return null; // no such application-scope property Object value = packet.invocationProperties.get(key); //add the attachments from the Message to the corresponding attachment property if(key.equals(MessageContext.INBOUND_MESSAGE_ATTACHMENTS)){ Map<String, DataHandler> atts = (Map<String, DataHandler>) value; if(atts == null) atts = new HashMap<String, DataHandler>(); AttachmentSet attSet = packet.getMessage().getAttachments(); for(Attachment att : attSet){ atts.put(att.getContentId(), att.asDataHandler()); } return atts; } return value; }
public Object get(Object key) { if(packet.supports(key)) return packet.get(key); // strongly typed if(packet.getHandlerScopePropertyNames(true).contains(key)) return null; // no such application-scope property Object value = packet.invocationProperties.get(key); //add the attachments from the Message to the corresponding attachment property if(key.equals(MessageContext.INBOUND_MESSAGE_ATTACHMENTS)){ Map<String, DataHandler> atts = (Map<String, DataHandler>) value; if(atts == null) atts = new HashMap<String, DataHandler>(); AttachmentSet attSet = packet.getMessage().getAttachments(); for(Attachment att : attSet){ atts.put(att.getContentId(), att.asDataHandler()); } return atts; } return value; }