Inheritance: Stratosphere.Aws.AmazonWebService
Example #1
0
 private SdbTable(SdbService service, string domainName, bool withConsistency, int?selectLimit)
 {
     _service         = service;
     _domainName      = domainName;
     _withConsistency = withConsistency;
     _selectLimit     = selectLimit;
 }
Example #2
0
        private static IEnumerable <XElement> SelectElements(SdbService service, string selectExpression, bool withConsistency)
        {
            string nextToken = null;

            do
            {
                XElement responseElement = service.Execute(
                    new SelectBuilder(selectExpression, nextToken, withConsistency));

                foreach (XElement itemElement in responseElement.Descendants(Sdb + "Item"))
                {
                    yield return(itemElement);
                }

                XElement nextTokenElement = responseElement.Descendants(Sdb + "NextToken").FirstOrDefault();

                if (nextTokenElement == null)
                {
                    nextToken = null;
                }
                else
                {
                    nextToken = nextTokenElement.Value;
                }
            }while (nextToken != null);
        }
Example #3
0
 private SdbTable(SdbService service, string domainName, bool withConsistency, int? selectLimit)
 {
     _service = service;
     _domainName = domainName;
     _withConsistency = withConsistency;
     _selectLimit = selectLimit;
 }
Example #4
0
        public static IEnumerable <SdbTable> ListTables(string serviceId, string serviceSecret, bool withConsistency, int?selectLimit)
        {
            SdbService service         = new SdbService(serviceId, serviceSecret);
            XElement   responseElement = service.Execute(new ListDomainsBuilder());

            foreach (string domainName in responseElement.Descendants(Sdb + "DomainName").Select(n => n.Value))
            {
                yield return(new SdbTable(service, domainName, withConsistency, selectLimit));
            }
        }
Example #5
0
        public static bool TryCreate(string serviceId, string serviceSecret, string domainName, bool withConsistency, int?selectLimit, bool ensureDomain, out SdbTable table)
        {
            SdbService service         = new SdbService(serviceId, serviceSecret);
            XElement   responseElement = service.Execute(new ListDomainsBuilder());

            if (responseElement.Descendants(Sdb + "DomainName").Select(n => n.Value).Contains(domainName))
            {
                table = new SdbTable(service, domainName, withConsistency, selectLimit);
                return(true);
            }

            if (ensureDomain)
            {
                table = Create(service, domainName, withConsistency, selectLimit);
                return(true);
            }

            table = null;
            return(false);
        }
Example #6
0
        public static SdbTable Create(string serviceId, string serviceSecret, string domainName, bool withConsistency, int?selectLimit)
        {
            SdbService service = new SdbService(serviceId, serviceSecret);

            return(Create(service, domainName, withConsistency, selectLimit));;
        }
Example #7
0
 private static SdbTable Create(SdbService service, string domainName, bool withConsistency, int?selectLimit)
 {
     service.Execute(new CreateDomainBuilder(domainName));
     return(new SdbTable(service, domainName, withConsistency, selectLimit));
 }
Example #8
0
 public static void ResetBoxUsage()
 {
     SdbService.ResetBoxUsage();
 }
Example #9
0
 public static SdbTable Create(string serviceId, string serviceSecret, string domainName, bool withConsistency, int? selectLimit)
 {
     SdbService service = new SdbService(serviceId, serviceSecret);
     return Create(service, domainName, withConsistency, selectLimit); ;
 }
Example #10
0
        private static IEnumerable<XElement> SelectElements(SdbService service, string selectExpression, bool withConsistency)
        {
            string nextToken = null;

            do
            {
                XElement responseElement = service.Execute(
                    new SelectBuilder(selectExpression, nextToken, withConsistency));

                foreach (XElement itemElement in responseElement.Descendants(Sdb + "Item"))
                {
                    yield return itemElement;
                }

                XElement nextTokenElement = responseElement.Descendants(Sdb + "NextToken").FirstOrDefault();

                if (nextTokenElement == null)
                {
                    nextToken = null;
                }
                else
                {
                    nextToken = nextTokenElement.Value;
                }
            }
            while (nextToken != null);
        }
Example #11
0
 private static SdbTable Create(SdbService service, string domainName, bool withConsistency, int? selectLimit)
 {
     service.Execute(new CreateDomainBuilder(domainName));
     return new SdbTable(service, domainName, withConsistency, selectLimit);
 }
Example #12
0
        public static bool TryCreate(string serviceId, string serviceSecret, string domainName, bool withConsistency, int? selectLimit, bool ensureDomain, out SdbTable table)
        {
            SdbService service = new SdbService(serviceId, serviceSecret);
            XElement responseElement = service.Execute(new ListDomainsBuilder());

            if (responseElement.Descendants(Sdb + "DomainName").Select(n => n.Value).Contains(domainName))
            {
                table = new SdbTable(service, domainName, withConsistency, selectLimit);
                return true;
            }

            if (ensureDomain)
            {
                table = Create(service, domainName, withConsistency, selectLimit);
                return true;
            }

            table = null;
            return false;
        }
Example #13
0
        public static IEnumerable<SdbTable> ListTables(string serviceId, string serviceSecret, bool withConsistency, int? selectLimit)
        {
            SdbService service = new SdbService(serviceId, serviceSecret);
            XElement responseElement = service.Execute(new ListDomainsBuilder());

            foreach (string domainName in responseElement.Descendants(Sdb + "DomainName").Select(n => n.Value))
            {
                yield return new SdbTable(service, domainName, withConsistency, selectLimit);
            }
        }