List of usage examples for com.amazonaws.services.simpledb AmazonSimpleDBClient AmazonSimpleDBClient
@Deprecated
public AmazonSimpleDBClient()
From source file:com.kikini.logging.simpledb.SimpleDBAppender.java
License:Apache License
/** * Obtain a SimpleDB instance from the Factory and get the logging domain * //from www .j a v a2s .c o m * @see ch.qos.logback.core.AppenderBase#start() */ @Override public void start() { boolean requiredPropsSet = true; if (null == accessId) { addStatus(new ErrorStatus("Access ID not set", this)); requiredPropsSet = false; } if (null == secretKey) { addStatus(new ErrorStatus("Secret key not set", this)); requiredPropsSet = false; } if (null == domainName) { addStatus(new ErrorStatus("Domain name not set", this)); requiredPropsSet = false; } if (null == endPoint) { addStatus(new ErrorStatus("EndPoint not set", this)); requiredPropsSet = false; } if (!requiredPropsSet) return; if (sdb == null) { try { if (instanceRole != null && !instanceRole.equals("")) { //Use instance profile credentials sdb = new AmazonSimpleDBClient(); } else { final AWSCredentials credentials = new BasicAWSCredentials(accessId, secretKey); sdb = new AmazonSimpleDBClient(credentials); } sdb.setEndpoint(this.endPoint); // See if the domain exists boolean found = false; ListDomainsResult result = sdb.listDomains(); for (String dom : result.getDomainNames()) { if (dom.equals(domainName)) { found = true; break; } } // Didn't find it, so create it if (!found) { sdb.createDomain(new CreateDomainRequest(domainName)); } } catch (AmazonClientException e) { addStatus(new ErrorStatus("Could not get access SimpleDB", this, e)); return; } } if (queue == null) { this.queue = new DelayQueue<SimpleDBRow>(); } if (writer == null) { this.writer = new SimpleDBWriter(sdb, domainName); } if (timeZone != null) { writer.setTimeZone(DateTimeZone.forID(timeZone)); } if (consumer == null) { consumer = new SimpleDBConsumer(queue, writer); } Thread consumerThread = new Thread(consumer); Runnable shutdown = new SimpleDBShutdownHook(queue, writer, consumerThread); Runtime.getRuntime().addShutdownHook(new Thread(shutdown)); consumerThread.setDaemon(true); consumerThread.start(); super.start(); }
From source file:com.netflix.simianarmy.client.aws.AWSClient.java
License:Apache License
/** * Amazon SimpleDB client.//from www . j a v a2 s .co m * * @return the Amazon SimpleDB client */ public AmazonSimpleDB sdbClient() { AmazonSimpleDB client; if (awsCredentialsProvider == null) { client = new AmazonSimpleDBClient(); } else { client = new AmazonSimpleDBClient(awsCredentialsProvider); } // us-east-1 has special naming // http://docs.amazonwebservices.com/general/latest/gr/rande.html#sdb_region if (region == null || region.equals("us-east-1")) { client.setEndpoint("sdb.amazonaws.com"); } else { client.setEndpoint("sdb." + region + ".amazonaws.com"); } return client; }
From source file:pl.worker.Main.java
public static void putToSDB(String file) { AmazonSimpleDBClient simpleDB = new AmazonSimpleDBClient(); simpleDB.setRegion(Region.getRegion(Regions.US_WEST_2)); simpleDB.putAttributes(new PutAttributesRequest("leszczynska_project", "Przetworzono plik", Arrays.asList(new ReplaceableAttribute("key", file, Boolean.FALSE)))); }