Skip to content
This repository was archived by the owner on Jan 10, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions samples/dynamodb-geo-ios/dynamodb-geo-ios/AWSConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

NSString *const AWSElasticBeanstalkEndpoint = @"http://YOUR-ENVIRONMENT.elasticbeanstalk.com/dynamodb-geo";

/*
* Use this instead to run on a local tomcat instance
*/

//NSString *const AWSElasticBeanstalkEndpoint = @"http://localhost:9090/dynamodb-geo";

@implementation AWSConstants

@end
29 changes: 29 additions & 0 deletions samples/dynamodb-geo-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,34 @@
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<!-- http port -->
<port>9090</port>
<!-- application path always starts with /-->
<path>/</path>
<!-- optional path to a context file -->
<contextFile>${tomcatContextXml}</contextFile>
<!-- optional system propoerties you want to add -->
<systemProperties>
<AWS_ACCESS_KEY_ID>XXXXXXXXX</AWS_ACCESS_KEY_ID>
<AWS_SECRET_KEY>YYYYYYYYY</AWS_SECRET_KEY>
<PARAM1>geo-test</PARAM1>
<PARAM2>us-east-1</PARAM2>
<is_local>true</is_local>
</systemProperties>
<!-- if you want to use test dependencies rather than only runtime -->
<useTestClasspath>false</useTestClasspath>
<!-- optional if you want to add some extra directories into the classloader -->
<additionalClasspathDirs>
<additionalClasspathDir></additionalClasspathDir>
</additionalClasspathDirs>
</configuration>

</plugin>
</plugins>
</pluginManagement>

Expand All @@ -120,6 +148,7 @@
</execution>
</executions>
</plugin>

</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,21 @@ public void init() throws ServletException {
}

private void setupGeoDataManager() {
System.out.println("setup");
String accessKey = System.getProperty("AWS_ACCESS_KEY_ID");
String secretKey = System.getProperty("AWS_SECRET_KEY");
String tableName = System.getProperty("PARAM1");
String regionName = System.getProperty("PARAM2");

AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);

AmazonDynamoDBClient ddb = new AmazonDynamoDBClient(credentials);
Region region = Region.getRegion(Regions.fromName(regionName));
ddb.setRegion(region);

if(System.getProperties().containsKey("is_local")) {
ddb.setEndpoint("http://localhost:8000");
}

config = new GeoDataManagerConfiguration(ddb, tableName);
geoDataManager = new GeoDataManager(config);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public boolean isRegionNameSet() {
return regionName != null && regionName.length() > 0;
}

public boolean isRunningLocal() {
return System.getProperties().containsKey("is_local");
}

public void setupTable() {
setupGeoDataManager();

Expand Down Expand Up @@ -98,6 +102,10 @@ private synchronized void setupGeoDataManager() {
AmazonDynamoDBClient ddb = new AmazonDynamoDBClient(credentials, clientConfiguration);
ddb.setRegion(region);

if(isRunningLocal()) {
ddb.setEndpoint("http://localhost:8000");
}

GeoDataManagerConfiguration config = new GeoDataManagerConfiguration(ddb, tableName);
geoDataManager = new GeoDataManager(config);
}
Expand Down