public Scope getScope(String arg0) { return context.getScope(arg0); }
public Object get(Object key) { Object o = context.get(key); if (context.getScope((String)key) == Scope.HANDLER) { return null; } return o; }
public Set<String> keySet() { Set<String> allKeys = context.keySet(); Set<String> keys = new HashSet<String>(); Iterator<String> it = allKeys.iterator(); while (it.hasNext()) { String k = it.next(); if (context.getScope(k) == Scope.APPLICATION) { keys.add(k); } } return keys; }
public boolean containsKey(Object key) { return context.containsKey(key) && context.getScope((String)key) == Scope.APPLICATION; }
public Collection<Object> values() { Collection<Object> values = new ArrayList<Object>(); Iterator<? extends String> it = context.keySet().iterator(); while (it.hasNext()) { String k = it.next(); if (context.getScope(k) == Scope.APPLICATION) { values.add(context.get(k)); } } return values; } }
public void clear() { Iterator<String> it = context.keySet().iterator(); while (it.hasNext()) { String k = it.next(); if (context.getScope(k) == Scope.APPLICATION) { context.remove(k); } } }
public Object remove(Object key) { if (context.containsKey(key) && context.getScope((String)key) == Scope.HANDLER) { throw new IllegalArgumentException( "Attempt to remove property with scope HANDLER from provider context."); } return context.remove(key); }
@SuppressWarnings("unchecked") public void putAll(Map<? extends String, ? extends Object> arg0) { context.putAll(arg0); if (arg0 instanceof MessageContext) { Iterator<String> iter = ((MessageContext)arg0).keySet().iterator(); while (iter.hasNext()) { String obj = iter.next(); context.setScope(obj, ((MessageContext)arg0).getScope(obj)); } } }
public boolean containsValue(Object value) { if (!context.containsValue(value)) { return false; } Iterator<String> it = context.keySet().iterator(); while (it.hasNext()) { String k = it.next(); if (context.get(k) == value && context.getScope(k) == Scope.APPLICATION) { return true; } } return false; }
public Object put(String key, Object value) { if (context.containsKey(key) && context.getScope(key) == Scope.HANDLER) { throw new IllegalArgumentException( "Attempt to set property with scope HANDLER in provider context."); } Object o = context.put(key, value); context.setScope(key, Scope.APPLICATION); return o; }
protected void populateResponseContext(MessageContext ctx) { Iterator<String> iter = ctx.keySet().iterator(); Map<String, Object> respCtx = getResponseContext(); while (iter.hasNext()) { String obj = iter.next(); if (MessageContext.Scope.APPLICATION.compareTo(ctx.getScope(obj)) == 0) { respCtx.put(obj, ctx.get(obj)); } } }