Example #1
0
        /// <exception cref="System.IO.IOException"/>
        public virtual void Put(TimelineDomain domain)
        {
            TimelineDomain domainToReplace  = domainsById[domain.GetId()];
            long           currentTimestamp = Runtime.CurrentTimeMillis();
            TimelineDomain domainToStore    = CreateTimelineDomain(domain.GetId(), domain.GetDescription
                                                                       (), domain.GetOwner(), domain.GetReaders(), domain.GetWriters(), (domainToReplace
                                                                                                                                         == null ? currentTimestamp : domainToReplace.GetCreatedTime()), currentTimestamp
                                                                   );

            domainsById[domainToStore.GetId()] = domainToStore;
            ICollection <TimelineDomain> domainsByOneOwner = domainsByOwner[domainToStore.GetOwner
                                                                                ()];

            if (domainsByOneOwner == null)
            {
                domainsByOneOwner = new HashSet <TimelineDomain>();
                domainsByOwner[domainToStore.GetOwner()] = domainsByOneOwner;
            }
            if (domainToReplace != null)
            {
                domainsByOneOwner.Remove(domainToReplace);
            }
            domainsByOneOwner.AddItem(domainToStore);
        }
Example #2
0
        /// <exception cref="System.IO.IOException"/>
        public virtual TimelineDomain GetDomain(string domainId)
        {
            TimelineDomain domain = domainsById[domainId];

            if (domain == null)
            {
                return(null);
            }
            else
            {
                return(CreateTimelineDomain(domain.GetId(), domain.GetDescription(), domain.GetOwner
                                                (), domain.GetReaders(), domain.GetWriters(), domain.GetCreatedTime(), domain.GetModifiedTime
                                                ()));
            }
        }