Esempio n. 1
0
        public void Preprocess(MarshalByRefObject inst, IMessage msg)
        {
            if (mServiceCacheItem == null)
            {
                mServiceCacheItem = ONServiceCacheItem.Get("Server", ClassName, ServiceName);
            }

            IMethodCallMessage lMsgIn = msg as IMethodCallMessage;

            // Extract Server
            ONServer lServer = inst as ONServer;

            // Take the active Instance
            bool lFind = false;

            foreach (ONInstance lInstance in lServer.OnContext.OperationStack)
            {
                if (((object)lInstance != null) && (lInstance == lServer.Instance))
                {
                    lServer.Instance = lInstance.GetFacet(lServer.Instance.ClassName);
                    lFind            = true;

                    break;
                }
            }

            // Push OID to Class Stack
            lServer.OnContext.OperationStack.Push(lServer.Instance);
            mInStack = true;

            // Check State Changes
            if (lServer.OnContext.NeedsVerification)
            {
                mServiceCacheItem.InvoqueCheckState(lServer, lMsgIn.Args);
                lServer.OnContext.NeedsVerification = false;
            }

            // Search all facets
            foreach (IONType lArgument in lMsgIn.InArgs)
            {
                ONOid lOidArgument = lArgument as ONOid;
                if (lOidArgument != null)
                {
                    if (!lOidArgument.Exist(lServer.OnContext, null))
                    {
                        throw new ONInstanceNotExistException(null, ONContext.GetComponent_Instance(lOidArgument.ClassName, lServer.OnContext).IdClass, lOidArgument.ClassName);
                    }
                }
            }

            // Check Precondition
            mServiceCacheItem.InvoquePrecondition(lServer, lMsgIn.Args);
        }
Esempio n. 2
0
        public void Preprocess(MarshalByRefObject inst, IMessage msg)
        {
            IMethodCallMessage lMsgIn = msg as IMethodCallMessage;

            // Extract Server
            ONServer lServer = inst as ONServer;

            // Take the active Instance
            bool lFind = false;

            foreach (ONInstance lInstance in lServer.OnContext.TransactionStack)
            {
                if (((object)lInstance != null) && (lInstance == lServer.Instance))
                {
                    lServer.Instance = lInstance.GetFacet(lServer.Instance.ClassName);
                    lFind            = true;

                    break;
                }
            }
            if (!lFind)
            {
                foreach (ONInstance lInstance in lServer.OnContext.OperationStack)
                {
                    if (((object)lInstance != null) && (lInstance == lServer.Instance))
                    {
                        lServer.Instance = lInstance.GetFacet(lServer.Instance.ClassName);
                        lFind            = true;

                        break;
                    }
                }
            }

            // Push OID to Class Stack
            lServer.OnContext.OperationStack.Push(lServer.Instance);
            mInStack = true;

            // Search all facets
            foreach (IONType lArgument in lMsgIn.InArgs)
            {
                ONOid lOidArgument = lArgument as ONOid;
                if (lOidArgument != null)
                {
                    if (!lOidArgument.Exist(lServer.OnContext, null))
                    {
                        throw new ONInstanceNotExistException(null, ONContext.GetComponent_Instance(lOidArgument.ClassName, lServer.OnContext).IdClass, lOidArgument.ClassName);
                    }
                }
            }
        }
Esempio n. 3
0
        public Dictionary <ONOid, ONInstance> CopyInstances(object[] ActualValues)
        {
            Dictionary <ONOid, ONInstance> AntValues = new Dictionary <ONOid, ONInstance>();

            foreach (ONInstance lInstance in ActualValues)
            {
                if ((lInstance != null) && (!AntValues.ContainsKey(lInstance.Oid)))
                {
                    ONInstance lCopyInstance = ONContext.GetComponent_Instance(lInstance.ClassName, OnContext);
                    lCopyInstance.Copy(lInstance);
                    AntValues.Add(lCopyInstance.Oid, lCopyInstance);
                }
            }
            return(AntValues);
        }
Esempio n. 4
0
        public ONInstance GetFacet(string className)
        {
            if (string.Compare(className, ClassName, true) == 0)
            {
                return(this);
            }

            object lInstance = ONContext.GetPropertyWithAttribute(this, typeof(ONFacetAttribute), "<Facet>" + className + "</Facet>");

            if (lInstance == null)
            {
                return(ONContext.GetComponent_Instance(className, OnContext));
            }

            return(ONContext.GetPropertyWithAttribute(this, typeof(ONFacetAttribute), "<Facet>" + className + "</Facet>") as ONInstance);
        }