diff --git a/.classpath b/.classpath index dabbdbc..1e37e9b 100644 --- a/.classpath +++ b/.classpath @@ -1,9 +1,8 @@ - - + - - + + - + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9bc6ec2..bc60bca 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.project b/.project index c01217d..8b0490e 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ - Android-Coconut + Android-Coconut-MobileFuton diff --git a/src/org/rti/rcd/ict/lgug/C2DMReceiver.java b/src/org/rti/rcd/ict/lgug/C2DMReceiver.java index 14628f0..ab444e5 100644 --- a/src/org/rti/rcd/ict/lgug/C2DMReceiver.java +++ b/src/org/rti/rcd/ict/lgug/C2DMReceiver.java @@ -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(); diff --git a/src/org/rti/rcd/ict/lgug/CoconutActivity.java b/src/org/rti/rcd/ict/lgug/CoconutActivity.java index 3bb599f..b4acfef 100644 --- a/src/org/rti/rcd/ict/lgug/CoconutActivity.java +++ b/src/org/rti/rcd/ict/lgug/CoconutActivity.java @@ -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();