Пример #1
0
 /// <summary>
 /// Get the host node depending on domain ID and collectionID
 /// </summary>
 /// <param name="domainID">ID of the domain</param>
 /// <param name="collectionID">Collection ID</param>
 /// <returns>Object of HostNode</returns>
 private static HostNode GetHostNode(string domainID, string collectionID)
 {
     try
     {
         HostNode       hNode = null;
         CollectionInfo ci    = GetCollectionInfo(collectionID);
         if (ci != null)
         {
             string hostID = ci.HostID;
             if (hostID != null)
             {
                 Domain domain  = Store.GetStore().GetDomain(domainID);
                 Member hMember = domain.GetMemberByID(hostID);
                 if (hMember != null)
                 {
                     log.Debug("Initializing hNode");
                     hNode = new HostNode(hMember);
                 }
             }
         }
         return(hNode);
     }
     catch (Exception ex)
     {
         log.Error(ex.Message);
         return(null);
     }
 }
Пример #2
0
        /// <summary>
        /// Create a proxy for a domain
        /// </summary>
        /// <param name="store">Cbject to refer to store</param>
        /// <param name="cinfo">Collection info object</param>
        /// <param name="DomainID">Id of the domain</param>
        /// <param name="iFolderID">iFolder ID</param>
        /// <param name="localPath">Local path of iFolder</param>
        public static void CreateProxy(Store store, CollectionInfo cinfo, string DomainID, string iFolderID, string localPath)
        {
            ArrayList commitList = new ArrayList();

//			CollectionInfo cinfo = DiscoveryFramework.GetCollectionInfo (iFolderID);

            Collection c = new Collection(store, cinfo.Name,
                                          cinfo.CollectionID, DomainID);

            c.HostID = cinfo.HostID;

            commitList.Add(c);

            // Create proxy member node
            Domain domain = store.GetDomain(DomainID);
            Member m      = domain.GetCurrentMember();

            Member member = new Member(m.Name, cinfo.MemberNodeID, m.UserID, Simias.Storage.Access.Rights.Admin, null);

            member.IsOwner = true;
            member.Proxy   = true;
            commitList.Add(member);

            DirNode dn = new DirNode(c, localPath, cinfo.DirNodeID);

            if (!Directory.Exists(localPath))
            {
                Directory.CreateDirectory(localPath);
            }

            dn.Proxy = true;
            commitList.Add(dn);

            c.Proxy = true;
            c.Commit((Node[])commitList.ToArray(typeof(Node)));
        }