Exemplo n.º 1
0
        public object Put(string key, object value_)
        {
            VMProxyArg vMProxyArg = (VMProxyArg)this.vmproxyhash[key];
            object     result;

            if (vMProxyArg != null)
            {
                result = vMProxyArg.setObject(this.wrappedContext, value_);
            }
            else if (this.localcontextscope)
            {
                this.localcontext[key] = value_;
                result = value_;
            }
            else if (this.localcontext.ContainsKey(key))
            {
                this.localcontext[key] = value_;
                result = value_;
            }
            else
            {
                result = this.innerContext.Put(key, value_);
            }
            return(result);
        }
Exemplo n.º 2
0
        public void AddVMProxyArg(VMProxyArg vmpa)
        {
            string contextReference = vmpa.ContextReference;

            if (vmpa.isConstant())
            {
                this.localcontext[contextReference] = vmpa.getObject(this.wrappedContext);
            }
            else
            {
                this.vmproxyhash[contextReference] = vmpa;
            }
        }
Exemplo n.º 3
0
        /// <summary>  Impl of the Context.gut() method.
        /// *
        /// </summary>
        /// <param name="key">name of item to get
        /// </param>
        /// <returns> stored object or null
        ///
        /// </returns>
        public Object Get(String key)
        {
            /*
             * first, see if it's a VMPA
             */

            Object o = null;

            VMProxyArg vmpa = (VMProxyArg)vmproxyhash[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[key];
                }
                else
                {
                    /*
                     *  try the local context
                     */

                    o = localcontext[key];

                    if (o == null)
                    {
                        /*
                         * last chance
                         */

                        o = innerContext.Get(key);
                    }
                }
            }

            return(o);
        }
Exemplo n.º 4
0
        /// <summary>  return the inner / user context
        /// </summary>
        /// <summary>  Used to put VMProxyArgs into this context.  It separates
        /// the VMProxyArgs into constant and non-constant types
        /// pulling out the value of the constant types so they can
        /// be modified w/o damaging the VMProxyArg, and leaving the
        /// dynamic ones, as they modify context rather than their own
        /// state
        /// </summary>
        /// <param name="vmpa">VMProxyArg to add
        ///
        /// </param>
        public void AddVMProxyArg(VMProxyArg vmpa)
        {
            /*
             *  ask if it's a constant : if so, get the value and put into the
             *  local context, otherwise, put the vmpa in our vmproxyhash
             */

            String key = vmpa.ContextReference;

            if (vmpa.isConstant())
            {
                localcontext[key] = vmpa.getObject(wrappedContext);
            }
            else
            {
                vmproxyhash[key] = vmpa;
            }
        }
Exemplo n.º 5
0
        /// <summary>  Impl of the Context.put() method.
        /// *
        /// </summary>
        /// <param name="key">name of item to set
        /// </param>
        /// <param name="value">object to set to key
        /// </param>
        /// <returns>old stored object
        ///
        /// </returns>
        public Object Put(String key, Object value_)
        {
            /*
             *  first see if this is a vmpa
             */

            VMProxyArg vmpa = (VMProxyArg)vmproxyhash[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[key] = value_);
                }
                else
                {
                    /*
                     *  ok, how about the local context?
                     */

                    if (localcontext.ContainsKey(key))
                    {
                        return(localcontext[key] = value_);
                    }
                    else
                    {
                        /*
                         * otherwise, let them push it into the 'global' context
                         */

                        return(innerContext.Put(key, value_));
                    }
                }
            }
        }
Exemplo n.º 6
0
        public object Get(string key)
        {
            VMProxyArg vMProxyArg = (VMProxyArg)this.vmproxyhash[key];
            object     obj;

            if (vMProxyArg != null)
            {
                obj = vMProxyArg.getObject(this.wrappedContext);
            }
            else if (this.localcontextscope)
            {
                obj = this.localcontext[key];
            }
            else
            {
                obj = this.localcontext[key];
                if (obj == null)
                {
                    obj = this.innerContext.Get(key);
                }
            }
            return(obj);
        }