Пример #1
0
        public DBSLineObjOrCall GetDefinition()
        {
            DBSLineObjOrCall result = new DBSLineObjOrCall();

            if (obj != null)
            {
                result.Obj = obj.Value;
            }
            else if (id != null)
            {
                result.Obj = id.Value;
            }
            else
            {
                result.isConnectorCall = address.IsConnector;

                result.Address = address.GetList();

                foreach (ObjectOrCall ooc in objOrCallList)
                {
                    result.Args.Add(ooc.GetDefinition());
                }
            }

            return result;
        }
Пример #2
0
        //private bool suffixContainsIdentifier(string txt)
        //{
        //    if (suffixList == null) return false;
        //    if (suffixList.HasValue)
        //    {
        //        foreach (Identifier id in suffixList.Value)
        //        {
        //            if (id.ValueText == txt) return true;
        //        }
        //    }
        //    return false;
        //}
        internal DBSLineDefinition getDefinition()
        {
            DBSLineDefinition result = new DBSLineDefinition();

            result.LineType = (endPoint == null ? DBSLineType.ProcessRequest : DBSLineType.AttachEndPoint);
            result.CreateConnector = (suffix != null && suffix.Create);
            result.IsReturn = (modifier != null && modifier.IsReturn);

            result.Start = new DBSLineObjOrCall();

            if (address != null)
            {
                result.Start.isConnectorCall = address.IsConnector;
                result.Start.Address = address.GetList();
            }

            if (optObjOrCallList != null && optObjOrCallList.HasValue)
            {
                foreach (ObjectOrCall ooc in optObjOrCallList.Value)
                {
                    result.Start.Args.Add(ooc.GetDefinition());
                }
            }
            else if (rightValue != null)
            {
                DBSLineObjOrCall ooc = new DBSLineObjOrCall();
                ooc.Obj = rightValue.Value;
                result.Start.Args.Add(ooc);
            }
            else if (rightValueObj != null)
            {
                DBSLineObjOrCall ooc = new DBSLineObjOrCall();
                ooc.Obj = rightValueObj.Value;
                result.Start.Args.Add(ooc);
            }
            else if (endPoint != null)
            {
                DBSLineObjOrCall ooc = new DBSLineObjOrCall();
                endPoint.FillDefinition(ooc);

                result.Start.Args.Add(ooc);
            }

            return result;
        }
Пример #3
0
 public void FillDefinition(DBSLineObjOrCall ooc)
 {
     if (address != null)
     {
         if (addressIsConnector == false)
         {
             ooc.Address = new List<string>() { null, address.GetBlockId(), address.GetServiceName()};
         }
         else
         {
             ooc.Address = new List<string>() { null, address.GetBlockId(), address.GetConnectorKey()};
             ooc.isConnectorCall = true;
         }
     }
     else if (epObject != null)
     {
         ooc.Obj = epObject.Value;
     }
     else
     {
         ooc.Obj = epIdentifier.Value;
     }
 }
Пример #4
0
        //private Connector.EndPoint createEndPoint(DBSLineObjOrCall fixedArg, Dictionary<string, object> argValues)
        //{
        //    DCRF.Contract.Connector.EndPoint result = new Connector.EndPoint(blockWeb);
        //    if (fixedArg.Obj != null)
        //    {
        //        result.Value = fixedArg.Obj;
        //    }
        //    else if (fixedArg.isConnectorCall)
        //    {
        //        string cblockId = (string)getVal(argValues, fixedArg.Address[1]);
        //        string cconnectorKey = (string)getVal(argValues, fixedArg.Address[2]);
        //        if (cblockId == null) cblockId = this.Id;
        //        result.BlockId = cblockId;
        //        result.ConnectorKey = cconnectorKey;
        //    }
        //    else
        //    {
        //        string cblockId = (string)getVal(argValues, fixedArg.Address[1]);
        //        string cServiceName = (string)getVal(argValues, fixedArg.Address[2]);
        //        if (cblockId == null) cblockId = this.Id;
        //        result.BlockId = cblockId;
        //        result.ServiceName = cServiceName;
        //    }
        //    foreach (DBSLineObjOrCall fa in fixedArg.Args)
        //    {
        //        DCRF.Contract.Connector.EndPoint ep = createEndPoint(fa, argValues);
        //        result.AddFixedArg(ep);
        //    }
        //    return result;
        //}
        private object handleProcessRequestServiceLine(DBSLineObjOrCall ooc, Dictionary<string, object> argValues)
        {
            if (ooc.Obj != null)
            {
                return getVal(argValues, ooc.Obj);
            }
            else if (ooc.Address == null && ooc.Args != null && ooc.Args.Count == 1)
            {
                return getVal(argValues, ooc.Args[0].Obj);
            }

            List<object> finalArgs = null;

            if (ooc.Args.Count > 0)
            {
                finalArgs = new List<object>();

                foreach (DBSLineObjOrCall ooc2 in ooc.Args)
                {
                    object itemResult = handleProcessRequestServiceLine(ooc2, argValues);

                    finalArgs.Add(itemResult);
                }
            }

            if (!ooc.isConnectorCall)
            {
                string blockId = (string) getVal(argValues, ooc.Address[1]);
                string service = (string)getVal(argValues, ooc.Address[2]);
                if (blockId == null) blockId = Id;

                if (finalArgs == null)
                {
                    return blockWeb[blockId].ProcessRequest(service);
                }
                else
                {
                    return blockWeb[blockId].ProcessRequest(service, finalArgs.ToArray());
                }
            }
            else
            {
                string blockId = (string)getVal(argValues, ooc.Address[1]);
                string connector = (string)getVal(argValues, ooc.Address[2]);
                if (blockId == null) blockId = Id;

                if (finalArgs == null)
                {
                    return blockWeb[blockId][connector].ProcessRequest();
                }
                else
                {
                    return blockWeb[blockId][connector].ProcessRequest(finalArgs.ToArray());
                }
            }
        }
Пример #5
0
        private void handleAttachEndpointServiceLine(DBSLineObjOrCall ooc, bool create, Dictionary<string, object> argValues)
        {
            string blockId = (string)getVal(argValues, ooc.Address[1]);
            string connectorKey = (string)getVal(argValues, ooc.Address[2]);
            if (blockId == null) blockId = Id;

            if (create)
            {
                blockWeb[blockId].ProcessRequest(
                    "ProcessMetaService",
                    BlockMetaServiceType.CreateConnector,
                    connectorKey,
                    null);
            }

            //if (single)
            //{
            //    blockWeb[blockId].ProcessRequest(
            //        "ProcessMetaService",
            //        BlockMetaServiceType.ClearConnector,
            //        connectorKey,
            //        null);
            //}

            IConnector connector = blockWeb[blockId][connectorKey];

            //we have only one item as an endpoint here
            DBSLineObjOrCall endPointDefinition = ooc.Args[0];
            //string endPointKey = null;

            if ( endPointDefinition.Obj != null )
            {
                connector.AttachEndPoint(getVal(argValues, endPointDefinition.Obj));
            }
            else if (endPointDefinition.isConnectorCall)
            {
                string cblockId = (string)getVal(argValues, endPointDefinition.Address[1]);
                string cconnectorKey = (string)getVal(argValues, endPointDefinition.Address[2]);

                if (cblockId == null) cblockId = this.Id;

                connector.AttachConnectorEndPoint(cblockId, cconnectorKey);
            }
            else
            {
                string cblockId = (string)getVal(argValues, endPointDefinition.Address[1]);
                string cServiceName = (string)getVal(argValues, endPointDefinition.Address[2]);

                if (cblockId == null) cblockId = this.Id;
                connector.AttachEndPoint(cblockId, cServiceName);
            }

            //foreach (DBSLineObjOrCall fixedArg in endPointDefinition.Args)
            //{
            //    DCRF.Contract.Connector.EndPoint ep = createEndPoint(fixedArg, argValues);

            //    connector.AddFixedArg(endPointKey, ep);
            //}
        }