/** * Impl of the Context.put() method. * * @param key name of item to set * @param value object to set to key * @return old stored object */ public Object put(String key, Object value) { /* * first see if this is a vmpa */ VMProxyArg vmpa = (VMProxyArg) vmproxyhash.get(key); if (vmpa != null) { return vmpa.setObject(wrappedContext, value); } else { if (localcontextscope) { /* * if we have localcontextscope mode, then just * put in the local context */ return localcontext.put(key, value); } else { /* * ok, how about the local context? */ if (localcontext.containsKey(key)) { return localcontext.put(key, value); } else { /* * otherwise, let them push it into the 'global' context */ return innerContext.put(key, value); } } } }
/** * Impl of the Context.gut() method. * * @param key name of item to get * @return stored object or null */ public Object get(String key) { /* * first, see if it's a VMPA */ Object o = null; VMProxyArg vmpa = (VMProxyArg) vmproxyhash.get(key); if (vmpa != null) { o = vmpa.getObject(wrappedContext); } else { if (localcontextscope) { /* * if we have localcontextscope mode, then just * put in the local context */ o = localcontext.get(key); } else { /* * try the local context */ o = localcontext.get(key); if (o == null) { /* * last chance */ o = innerContext.get(key); } } } return o; }
/** * Put method also stores values in parent context * * @param key name of item to set * @param value object to set to key * @return old stored object */ public Object put(String key, Object value) { /* * just put in the local context */ return innerContext.put(key, value); }
/** @see org.apache.velocity.context.InternalWrapperContext#getBaseContext() */ public InternalContextAdapter getBaseContext() { return innerContext.getBaseContext(); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#getCurrentResource() */ public Resource getCurrentResource() { return innerContext.getCurrentResource(); }
/** @see org.apache.velocity.context.InternalEventContext#getEventCartridge() */ public EventCartridge getEventCartridge() { return innerContext.getEventCartridge(); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#getMacroLibraries() */ public List getMacroLibraries() { return innerContext.getMacroLibraries(); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#setAllowRendering(boolean) */ public void setAllowRendering(boolean v) { innerContext.setAllowRendering(v); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#getTemplateNameStack() */ public Object[] getTemplateNameStack() { return innerContext.getTemplateNameStack(); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#getCurrentTemplateName() */ public String getCurrentTemplateName() { return innerContext.getCurrentTemplateName(); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#popCurrentTemplateName() */ public void popCurrentTemplateName() { innerContext.popCurrentTemplateName(); }
/** * @see * org.apache.velocity.context.InternalHousekeepingContext#pushCurrentTemplateName(java.lang.String) */ public void pushCurrentTemplateName(String s) { innerContext.pushCurrentTemplateName(s); }
/** @see org.apache.velocity.context.Context#remove(java.lang.Object) */ public Object remove(Object key) { return innerContext.remove(key); }
/** @see org.apache.velocity.context.Context#getKeys() */ public Object[] getKeys() { return innerContext.getKeys(); }
/** CTOR, wraps an ICA */ public VMContext(InternalContextAdapter inner, RuntimeServices rsvc) { localcontextscope = rsvc.getBoolean(RuntimeConstants.VM_CONTEXT_LOCALSCOPE, false); wrappedContext = inner; innerContext = inner.getBaseContext(); }
/** * @see org.apache.velocity.context.InternalHousekeepingContext#icachePut(java.lang.Object, * org.apache.velocity.util.introspection.IntrospectionCacheData) */ public void icachePut(Object key, IntrospectionCacheData o) { innerContext.icachePut(key, o); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#getAllowRendering() */ public boolean getAllowRendering() { return innerContext.getAllowRendering(); }
/** * @see * org.apache.velocity.context.InternalHousekeepingContext#pushCurrentMacroName(java.lang.String) */ public void pushCurrentMacroName(String s) { innerContext.pushCurrentMacroName(s); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#setMacroLibraries(List) */ public void setMacroLibraries(List macroLibraries) { innerContext.setMacroLibraries(macroLibraries); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#popCurrentMacroName() */ public void popCurrentMacroName() { innerContext.popCurrentMacroName(); }
/** * @see * org.apache.velocity.context.InternalEventContext#attachEventCartridge(org.apache.velocity.app.event.EventCartridge) */ public EventCartridge attachEventCartridge(EventCartridge ec) { return innerContext.attachEventCartridge(ec); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#getCurrentMacroName() */ public String getCurrentMacroName() { return innerContext.getCurrentMacroName(); }
/** * @see * org.apache.velocity.context.InternalHousekeepingContext#setCurrentResource(org.apache.velocity.runtime.resource.Resource) */ public void setCurrentResource(Resource r) { innerContext.setCurrentResource(r); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#getCurrentMacroCallDepth() */ public int getCurrentMacroCallDepth() { return innerContext.getCurrentMacroCallDepth(); }
/** * Return the inner / user context. * * @return The inner / user context. */ public Context getInternalUserContext() { return innerContext.getInternalUserContext(); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#getMacroNameStack() */ public Object[] getMacroNameStack() { return innerContext.getMacroNameStack(); }
/** * Retrieves from parent context. * * @param key name of item to get * @return stored object or null */ public Object get(String key) { return innerContext.get(key); }
/** @see org.apache.velocity.context.InternalHousekeepingContext#icacheGet(java.lang.Object) */ public IntrospectionCacheData icacheGet(Object key) { return innerContext.icacheGet(key); }
/** @see org.apache.velocity.context.Context#containsKey(java.lang.Object) */ public boolean containsKey(Object key) { return innerContext.containsKey(key); }
/** * @see * org.apache.velocity.context.InternalWrapperContext#localPut(java.lang.String,java.lang.Object) */ public Object localPut(final String key, final Object value) { return innerContext.put(key, value); }