Пример #1
0
        }       //	prepare

        /// <summary>
        /// Process
        /// </summary>
        /// <returns>info</returns>
        protected override String DoIt()
        {
            _apps_host = new VConnection();
            CacheHandler thisHandler = new CacheHandler
                                       //(CacheHandler.ConvertJNPURLToCacheURL(GetCtx().GetContext("java.naming.provider.url")), log, GetCtx(), Get_Trx());
                                           (CacheHandler.ConvertJNPURLToCacheURL((String)_apps_host.Apps_host), log, GetCtx(), Get_Trx());

            log.Info("CM_WebProject_ID=" + _CM_WebProject_ID);
            _project = new MWebProject(GetCtx(), _CM_WebProject_ID, Get_Trx());
            if (_project.Get_ID() != _CM_WebProject_ID)
            {
                throw new Exception("@NotFound@ @CM_WebProject_ID@ " + _CM_WebProject_ID);
            }
            log.Log(Level.INFO, "Starting media deployment");
            //	Deploy Media
            MMediaServer[] mserver = MMediaServer.GetMediaServer(_project);

            for (int i = 0; i < mserver.Length; i++)
            {
                log.Log(Level.INFO, "Media Server deployment started on: " + mserver.ToString());
                if (_isRedeploy)
                {
                    mserver[i].ReDeployAll();
                }
                mserver[i].Deploy();
                log.Log(Level.INFO, "Media Server deployment finished on: " + mserver.ToString());
            }

            //	Stage
            MCStage[] stages = MCStage.GetStages(_project);
            for (int i = 0; i < stages.Length; i++)
            {
                _map.Add(Utility.Util.GetValueOfInt(stages[i].GetCM_CStage_ID()), stages[i]);
            }

            //	Copy Stage Tree
            MTree     treeS = new MTree(GetCtx(), _project.GetAD_TreeCMS_ID(), false, false, Get_Trx());
            VTreeNode root  = treeS.GetRootNode();

            CopyStage(root, "/", _isRedeploy);

            //	Delete Inactive Containers
            MContainer[] containers = MContainer.GetContainers(_project);
            for (int i = 0; i < containers.Length; i++)
            {
                MContainer container = containers[i];
                if (!_idList.Contains(Utility.Util.GetValueOfInt(container.GetCM_Container_ID())))
                {
                    String name = container.GetName();
                    if (container.Delete(true))
                    {
                        log.Fine("Deleted: " + name);
                    }
                    else        //	e.g. was referenced
                    {
                        log.Warning("Failed Delete: " + name);
                        AddLog(0, null, null, "@Error@ @Delete@: " + name);
                    }
                }
                // Remove Container from cache
                thisHandler.CleanContainer(container.Get_ID());
            }   //	Delete Inactive

            //	Sync Stage & Container Tree
            MTreeNodeCMS[] nodesCMS = MTreeNodeCMS.GetTree(GetCtx(), _project.GetAD_TreeCMS_ID(), Get_Trx());
            MTreeNodeCMC[] nodesCMC = MTreeNodeCMC.GetTree(GetCtx(), _project.GetAD_TreeCMC_ID(), Get_Trx());
            for (int s = 0; s < nodesCMS.Length; s++)
            {
                MTreeNodeCMS nodeCMS = nodesCMS[s];
                int          Node_ID = nodeCMS.GetNode_ID();
                for (int c = 0; c < nodesCMC.Length; c++)
                {
                    MTreeNodeCMC nodeCMC = nodesCMC[c];
                    if (nodeCMC.GetNode_ID() == Node_ID)
                    {
                        //if (nodeCMS.getParent_ID()!=0)
                        nodeCMC.setParent_ID(nodeCMS.GetParent_ID());
                        nodeCMC.SetSeqNo(nodeCMS.GetSeqNo());
                        nodeCMC.Save();
                        break;
                    }
                }
            }   //	for all stage nodes
            // Clean ContainerTree Cache
            thisHandler.CleanContainerTree(_CM_WebProject_ID);

            return("@Copied@ @CM_Container_ID@ #" + _idList.Count);
        }       //	doIt