Skip to content

Commit

Permalink
tested for Couchbase-2.0.0 beta
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisekelley committed Jan 17, 2012
1 parent 6abd665 commit 0e03c25
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 30 deletions.
9 changes: 4 additions & 5 deletions .classpath
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<?xml version="1.0" encoding="UTF-8"?><classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/couchbase.jar"/>
<classpathentry kind="lib" path="libs/OtpErlang.jar"/>


<classpathentry kind="output" path="bin/classes"/>
</classpath>
<classpathentry kind="lib" path="libs/couchbase-2.0.0-dp-31.jar"/><classpathentry kind="lib" path="libs/OtpErlang-r14b03.jar"/></classpath>
6 changes: 6 additions & 0 deletions .gitignore
Expand Up @@ -17,3 +17,9 @@ local-config/coconut.properties

local-config/local.properties
res/raw/coconut.properties

assets/CouchbaseVersion.txt

libs/OtpErlang-r14b03.jar

libs/couchbase-2.0.0-dp-31.jar
2 changes: 1 addition & 1 deletion .project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Android-Coconut</name>
<name>Android-Coconut-MobileFuton</name>
<comment></comment>
<projects>
</projects>
Expand Down
2 changes: 1 addition & 1 deletion src/org/rti/rcd/ict/lgug/C2DMReceiver.java
Expand Up @@ -105,7 +105,7 @@ protected void onMessage(Context context, Intent intent) {
notification.ledARGB = 0xff00ff00;
notification.ledOnMS = 300;
notification.ledOffMS = 1000;

//Context context = getApplicationContext();
Log.d(TAG, "Triggering once_off replication upon receipt of notification: " + message);
Properties properties = new Properties();
Expand Down
49 changes: 26 additions & 23 deletions src/org/rti/rcd/ict/lgug/CoconutActivity.java
Expand Up @@ -291,29 +291,32 @@ public void couchbaseStarted(String host, int port) {
setPUSH_SERVER_URL(pushServerUrl);
Log.d(TAG, "PUSH_SERVER_URL: " + PUSH_SERVER_URL);
}
if (C2DM_SENDER == null) {
String c2dmSender = properties.getProperty("c2dm_sender");
setC2DM_SENDER(c2dmSender);
Log.d(TAG, "C2DM_SENDER: " + C2DM_SENDER);
}
String localDb = "http://localhost:" + properties.getProperty("local_couch_app_port") +"/" + properties.getProperty("app_db");
Log.d(TAG, "localDb: " + localDb);
String localReplicationDbUrl = "http://localhost:" + properties.getProperty("local_couch_app_port") +"/_replicate";
String replicationMasterUrl = "http://" + properties.getProperty("master_server") + "/coconut";
String replicationDataFromMaster = "{\"_id\": \"continuous_from_master\",\"target\":\"" + localDb + "\",\"source\":\"" + replicationMasterUrl + "\", \"continuous\": true}";
String replicationDataToMaster = "{\"_id\": \"continuous_to_master\",\"target\":\"" + replicationMasterUrl + "\",\"source\":\"" + localDb + "\", \"continuous\": true}";

try {
HTTPRequest.post(localReplicationDbUrl, replicationDataFromMaster);
} catch (JSONException e) {
Log.d(TAG, "Problem installing replication target FromMaster. replicationMasterUrl: " + replicationMasterUrl + " Error:" + e.getMessage());
e.printStackTrace();
}
try {
HTTPRequest.post(localReplicationDbUrl, replicationDataToMaster);
} catch (JSONException e) {
Log.d(TAG, "Problem installing replication target ToMaster. replicationMasterUrl: " + replicationMasterUrl + " Error:" + e.getMessage());
e.printStackTrace();
// If PUSH_SERVER_URL is still null, don't configure C2DM or replication.
if (PUSH_SERVER_URL == null) {
if (C2DM_SENDER == null) {
String c2dmSender = properties.getProperty("c2dm_sender");
setC2DM_SENDER(c2dmSender);
Log.d(TAG, "C2DM_SENDER: " + C2DM_SENDER);
}
String localDb = "http://localhost:" + properties.getProperty("local_couch_app_port") +"/" + properties.getProperty("app_db");
Log.d(TAG, "localDb: " + localDb);
String localReplicationDbUrl = "http://localhost:" + properties.getProperty("local_couch_app_port") +"/_replicate";
String replicationMasterUrl = "http://" + properties.getProperty("master_server") + "/coconut";
String replicationDataFromMaster = "{\"_id\": \"continuous_from_master\",\"target\":\"" + localDb + "\",\"source\":\"" + replicationMasterUrl + "\", \"continuous\": true}";
String replicationDataToMaster = "{\"_id\": \"continuous_to_master\",\"target\":\"" + replicationMasterUrl + "\",\"source\":\"" + localDb + "\", \"continuous\": true}";

try {
HTTPRequest.post(localReplicationDbUrl, replicationDataFromMaster);
} catch (JSONException e) {
Log.d(TAG, "Problem installing replication target FromMaster. replicationMasterUrl: " + replicationMasterUrl + " Error:" + e.getMessage());
e.printStackTrace();
}
try {
HTTPRequest.post(localReplicationDbUrl, replicationDataToMaster);
} catch (JSONException e) {
Log.d(TAG, "Problem installing replication target ToMaster. replicationMasterUrl: " + replicationMasterUrl + " Error:" + e.getMessage());
e.printStackTrace();
}
}
} catch (IOException e) {
e.printStackTrace();
Expand Down

0 comments on commit 0e03c25

Please sign in to comment.