Package com.amazonaws.services.simpledb

Examples of com.amazonaws.services.simpledb.AmazonSimpleDBClient


        // prepare the credentials
        String accessKey = Constants.ACCESS_KEY;
        String secretKey = Constants.SECRET_KEY;

        // create the SimpleDB service
        AmazonSimpleDB sdbService = new AmazonSimpleDBClient(
            new BasicAWSCredentials(accessKey, secretKey));

        // set the endpoint for us-east-1 region
        sdbService.setEndpoint("https://sdb.amazonaws.com");
       
        new SimpleDBExamples().run(sdbService);

    }
View Full Code Here


    private AmazonSimpleDB simpleDB;
    private SimpleDateFormat format;

    public SQSLogger(AWSCredentials credentials) {
        // get the SimpleDB service
        simpleDB = new AmazonSimpleDBClient(credentials);
        format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        format.setTimeZone(TimeZone.getTimeZone("GMT"));
    }
View Full Code Here

        String secretKey = Constants.SECRET_KEY;
        AWSCredentials credentials = new BasicAWSCredentials(accessKey,
                secretKey);

        // get the SimpleDB service
        AmazonSimpleDB simpleDB = new AmazonSimpleDBClient(credentials);
        // get the metadata for a domain called "my_domain"
        DomainMetadataResult result = simpleDB.domainMetadata(
                new DomainMetadataRequest(Constants.A_SIMPLEDB_DOMAIN));
       
        // number of attributes
        // check if we already have 90% of the maximum number of attributes allowed
        if (result.getAttributeNameCount() > 900000000) {
View Full Code Here

            }

            awsCredentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey);
        }

        this.simpleDbClient = new AmazonSimpleDBClient(awsCredentials, createConfiguration(sdbSecure));
        this.simpleDbClient.setEndpoint(sdbEndpoint);

        this.s3Client = new AmazonS3Client(awsCredentials, createConfiguration(s3Secure));
        this.s3Client.setEndpoint(s3Endpoint);
    }
View Full Code Here

   *
   * @param accessId AWS access id
   * @param accessSecret AWS secret
   */
  protected SimpleDBConnection(String accessId, String accessSecret) {
    this.sdb = new AmazonSimpleDBClient(new BasicAWSCredentials(accessId,
        accessSecret));
  }
View Full Code Here

   */
  protected SimpleDBConnection(String accessId, String accessSecret,
      SimpleDBProxy proxy) {
    log.info("creating a connection with proxy information: " + proxy);
    ClientConfiguration conf = getAWSConfiguration(proxy);
    this.sdb = new AmazonSimpleDBClient(new BasicAWSCredentials(accessId,
        accessSecret), conf);
    log.info("done creating SDB connection, Client is init'ed -> " + this.sdb.toString());
  }
View Full Code Here

         * Important: Be sure to fill in your AWS access credentials in the
         *            AwsCredentials.properties file before you try to run this
         *            sample.
         * http://aws.amazon.com/security-credentials
         */
        AmazonSimpleDB sdb = new AmazonSimpleDBClient(new PropertiesCredentials(
                SimpleDBSample.class.getResourceAsStream("AwsCredentials.properties")));

        System.out.println("===========================================");
        System.out.println("Getting Started with Amazon SimpleDB");
        System.out.println("===========================================\n");

        try {
            // Create a domain
            String myDomain = "MyStore";
            System.out.println("Creating domain called " + myDomain + ".\n");
            sdb.createDomain(new CreateDomainRequest(myDomain));

            // List domains
            System.out.println("Listing all domains in your account:\n");
            for (String domainName : sdb.listDomains().getDomainNames()) {
                System.out.println("  " + domainName);
            }
            System.out.println();

            // Put data into a domain
            System.out.println("Putting data into " + myDomain + " domain.\n");
            sdb.batchPutAttributes(new BatchPutAttributesRequest(myDomain, createSampleData()));

            // Select data from a domain
            // Notice the use of backticks around the domain name in our select expression.
            String selectExpression = "select * from `" + myDomain + "` where Category = 'Clothes'";
            System.out.println("Selecting: " + selectExpression + "\n");
            SelectRequest selectRequest = new SelectRequest(selectExpression);
            for (Item item : sdb.select(selectRequest).getItems()) {
                System.out.println("  Item");
                System.out.println("    Name: " + item.getName());
                for (Attribute attribute : item.getAttributes()) {
                    System.out.println("      Attribute");
                    System.out.println("        Name:  " + attribute.getName());
                    System.out.println("        Value: " + attribute.getValue());
                }
            }
            System.out.println();

            // Delete values from an attribute
            System.out.println("Deleting Blue attributes in Item_O3.\n");
            Attribute deleteValueAttribute = new Attribute("Color", "Blue");
            sdb.deleteAttributes(new DeleteAttributesRequest(myDomain, "Item_03")
                    .withAttributes(deleteValueAttribute));

            // Delete an attribute and all of its values
            System.out.println("Deleting attribute Year in Item_O3.\n");
            sdb.deleteAttributes(new DeleteAttributesRequest(myDomain, "Item_03")
                    .withAttributes(new Attribute().withName("Year")));

            // Replace an attribute
            System.out.println("Replacing Size of Item_03 with Medium.\n");
            List<ReplaceableAttribute> replaceableAttributes = new ArrayList<ReplaceableAttribute>();
            replaceableAttributes.add(new ReplaceableAttribute("Size", "Medium", true));
            sdb.putAttributes(new PutAttributesRequest(myDomain, "Item_03", replaceableAttributes));

            // Delete an item and all of its attributes
            System.out.println("Deleting Item_03.\n");
            sdb.deleteAttributes(new DeleteAttributesRequest(myDomain, "Item_03"));

            // Delete a domain
            System.out.println("Deleting " + myDomain + " domain.\n");
            sdb.deleteDomain(new DeleteDomainRequest(myDomain));
        } catch (AmazonServiceException ase) {
            System.out.println("Caught an AmazonServiceException, which means your request made it "
                    + "to Amazon SimpleDB, but was rejected with an error response for some reason.");
            System.out.println("Error Message:    " + ase.getMessage());
            System.out.println("HTTP Status Code: " + ase.getStatusCode());
View Full Code Here

  public static void init()
  {
    try
    {
      sdb = new AmazonSimpleDBClient(new PropertiesCredentials(
                SimpleDBSample.class.getResourceAsStream("AwsCredentials.properties")));
      // Create a domain
      //sdb.createDomain(new CreateDomainRequest(myDomain));       
      s3 = new AmazonS3Client(new PropertiesCredentials(
          S3Sample.class.getResourceAsStream("AwsCredentials.properties")));
View Full Code Here

        return emailServiceClient;
    }

    public static AmazonSimpleDBClient getAmazonSimpleDBClient() {
        if (simpleDBClient == null) {
            simpleDBClient = new AmazonSimpleDBClient(awsCredentialsProvider, clientConfig);
            if (System.getProperty("EC2_REGION") != null && !"us-east-1".equals(System.getProperty("EC2_REGION"))) {
                if ("global".equals(System.getProperty("EC2_REGION"))) {
                    simpleDBClient.setEndpoint("sdb.amazonaws.com");
                }
                else {
View Full Code Here

    this.jobDomain = String.format("%s.%s", prefix,
        SimpleDbJobStore.JOB_DOMAIN);
    this.triggerDomain = String.format("%s.%s", prefix,
        SimpleDbJobStore.TRIGGER_DOMAIN);
    this.query = new QueryBuilder(this.jobDomain, this.triggerDomain);
    this.amazonSimpleDb = new AmazonSimpleDBClient(new BasicAWSCredentials(
        awsAccessKey, awsSecretKey));
    this.signaler = signaler;

    boolean foundJobs = false, foundTriggers = false;
    List<String> domainNames = getSimpleDbDomainNames();
View Full Code Here

TOP

Related Classes of com.amazonaws.services.simpledb.AmazonSimpleDBClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.