Ejemplo n.º 1
0
        public override void Execute(ExecutionContext context)
        {
            if (context.CurrentBlockWeb != null && ownerBlockId == null)
            {
                throw new Exception("You cannot nest standalone blockWebs");
            }

            IBlockWeb newWeb = null;
            IBlockWeb oldWeb = context.CurrentBlockWeb;

            if (ownerBlockId != null)
            {
                newWeb = (IBlockWeb)context.CurrentBlockWeb[ownerBlockId].ProcessRequest("ProcessMetaService", BlockMetaServiceType.GetInnerWeb,
                    null, null);
            }
            else
            {
                newWeb = new BlockWeb(webId, context.Broker);
            }

            context.CurrentBlockWeb = newWeb;

            if (webId != null)
            {
                context.blockWebs[webId] = newWeb;
            }

            base.Execute(context);

            context.CurrentBlockWeb = oldWeb;
        }
Ejemplo n.º 2
0
        public override void Execute()
        {
            //template blockWebs are not executed, they are just imported
            if (suffix != null && suffix.IsAbstract) return;

            IBlockWeb result = null;
            ExecutionContext.EnterLevel();

            result = new BlockWeb(name.ValueText, ExecutionContext.Current.DefaultBroker, null, DCRF.Definition.PlatformType.Neutral,
                null, suffix.IsRemotable);
            ExecutionContext.Current.RegisterBlockWeb(result, false);

            innerExecute(result);

            ExecutionContext.ExitLevel();
        }
Ejemplo n.º 3
0
        public static object ProcessNode(XmlElement element, IBlockWeb blockWeb, string blockId, IConnector connector)
        {
            switch (element.Name)
            {
                case "blockWeb":
                    {
                        string id = null;
                        if (element.HasAttribute("id"))
                        {
                            id = element.GetAttribute("id");
                        }

                        BlockWeb newWeb = null;

                        if ( blockId != null )
                        {
                            newWeb = (BlockWeb) blockWeb[blockId].ProcessRequest("ProcessMetaService", BlockMetaServiceType.GetInnerWeb,
                                null, null);
                        }
                        else
                        {
                            newWeb = new BlockWeb(id, DefaultBroker);
                        }

                        TemplateProcessor.ProcessTemplateFile(element, newWeb, blockId, connector);
                        ProcessNodeChildren(element, newWeb, blockId, connector);

                        return newWeb;
                    }
                case "actions":
                    {
                        TemplateProcessor.ProcessTemplateFile(element, blockWeb, blockId, connector);

                        ProcessNodeChildren(element, blockWeb, blockId, connector);

                        break;
                    }
                case "blocks":
                    {
                        TemplateProcessor.ProcessTemplateFile(element, blockWeb, blockId, connector);

                        ProcessNodeChildren(element, blockWeb, blockId, connector);

                        break;
                    }
                case "block":
                    {
                        BlockHandle cid = ObjectReader.ReadBlockHandle(element);
                        string id = null;

                        if (element.HasAttribute("id"))
                        {
                            id = element.GetAttribute("id");
                        }
                        else
                        {
                            id = "ctl_" + (Guid.NewGuid().ToString());
                        }

                        blockWeb.AddBlock(cid, id);

                        TemplateProcessor.ProcessTemplateFile(element, blockWeb, id, connector);

                        ProcessNodeChildren(element, blockWeb, id, connector);

                        //(blockWeb[id] as IContainedBlock).OnAfterLoad();

                        break;
                    }
                case "attachEndPoint":
                    {
                        EndPointExtractor.ProcessAttachEndPointsAction(element, blockWeb, blockId);

                        break;
                    }
                case "processRequest":
                    {
                        ActionProcessor.ProcessProcessRequest(element, blockWeb, blockId);

                        break;
                    }
                case "setProperty":
                    {
                        ActionProcessor.ProcessSetProperty(element, blockWeb, blockId);

                        break;
                    }
                case "setVariable":
                    {
                        ActionProcessor.ProcessSetVariable(element, blockWeb, blockId);

                        break;
                    }
                case "serviceEndPoint":
                case "valueEndPoint":
                case "connectorEndPoint":
                    {
                        EndPointExtractor.ProcessAttachEndPoint(blockWeb, connector, element, blockId);

                        break;
                    }
            }

            return null;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes Block - this method is called after component is being BlockWebd.
 /// </summary>
 public virtual void InitBlock()
 {
     innerWeb = new BlockWeb(null, null, blockWeb as BlockWeb, PlatformType.Neutral, this, MakeInnerWebsRemotable);
 }
Ejemplo n.º 5
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            trees = new List<ctlWebTree>();
            trees.Add(treeTopLeft);
            trees.Add(treeTopRight);
            trees.Add(treeBottomLeft);
            trees.Add(treeBottomRight);

            treeTopLeft.Index = 0;
            treeTopRight.Index = 1;
            treeBottomLeft.Index = 2;
            treeBottomRight.Index = 3;

            treeTopLeft.trees = treeTopRight.trees = treeBottomRight.trees = treeBottomLeft.trees = trees;
            treeTopLeft.ImageList = treeTopRight.ImageList = treeBottomRight.ImageList = treeBottomLeft.ImageList = imgNodes;
            treeTopLeft.MenuImageList = treeTopRight.MenuImageList = treeBottomRight.MenuImageList = treeBottomLeft.MenuImageList = imgMenuItems;

            defaultTree = treeTopLeft;

            int random = new Random().Next(1000);
            dummyWeb = new BlockWeb("AdminConsole (" + random.ToString() + ")", null, null, PlatformType.Neutral, null, true);

            //dummyWeb.GetConnector(SysEventCode.PeerDisconnected).AttachEndPoint( .PeerDisconnected += new PeerConnectDelegate(dummyWeb_PeerDisconnected);

            treeTopLeft.container = treeTopRight.container = treeBottomRight.container = treeBottomLeft.container = dummyWeb;
        }
Ejemplo n.º 6
0
        private void construct(string id, BlockWeb containerWeb, IBlockBroker broker, PlatformType platform, 
            IContainerBlock cont, bool isRemotable)
        {
            this.platform = platform;

            if (containerWeb != null)
            {
                blockBroker = containerWeb.blockBroker;
            }
            else if (broker != null)
            {
                blockBroker = broker;
            }

            if (id != null)
            {
                this.myId = id;
            }
            else
            {
                this.myId = random.Next().ToString();
            }

            containerBlock = cont;

            if ( isRemotable ) startServer();
        }
Ejemplo n.º 7
0
 public BlockWeb(string id = null, IBlockBroker broker = null, BlockWeb containerWeb = null,  
     PlatformType platform = PlatformType.Neutral, IContainerBlock containerBlock = null, bool isRemotable = false)
 {
     construct(id, containerWeb, broker, platform, containerBlock, isRemotable);
 }