Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

change to support only local service

updated README with changes to delegate
updated README link to binary download
updated README list of examples
updated README.txt in user documentation

Change-Id: I2b1d22db0f52c7e6e67959db850a25a53e2f5c77
Reviewed-on: http://review.couchbase.org/9365
Reviewed-by: Marty Schoch <marty.schoch@gmail.com>
Reviewed-by: Chris Anderson <jchris@couchbase.com>
Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
Tested-by: Dale Harvey <daleharvey@arandomurl.com>
  • Loading branch information...
commit af24b115c8992260e9a698121d036a50d06aa883 1 parent a051e99
@mschoch mschoch authored Dale Harvey committed
View
10 README.markdown
@@ -29,7 +29,7 @@ NOTE: You do not need the source of this repository to use Mobile Couchbase in y
1. Create a new Android project or select an existing project
2. Download the Android-Couchbase.zip
- - https://github.com/downloads/couchbase/Android-Couchbase/Android-Couchbase.zip
+ - http://files.couchbase.com/developer-previews/mobile/android/android-couchbase-dp.zip
3. Extract Android-Couchbase.zip, you will see 3 files
- Couchbase.zip
@@ -48,7 +48,7 @@ Now that your project supports Couchbase, starting Cocuhbase is accomplished by
1. Create an instance of ICouchbaseDelegate, you can implement these methods to respond to Couchbase events
<pre>
- private final ICouchbaseDelegate mCallback = new ICouchbaseDelegate.Stub() {
+ private final ICouchbaseDelegate mDelegate = new ICouchbaseDelegate() {
@Override
public void couchbaseStarted(String host, int port) {}
@@ -86,7 +86,11 @@ Now that your project supports Couchbase, starting Cocuhbase is accomplished by
## Examples
-For examples please look at https://github.com/couchbase/Android-EmptyApp
+For examples please look at:
+
+* https://github.com/couchbase/Android-EmptyApp
+* https://github.com/daleharvey/Android-MobileFuton
+* https://github.com/couchbaselabs/AndroidGrocerySync
## Build information
View
10 build.xml
@@ -81,7 +81,15 @@
<path id="android.libraries.jars"><path refid="project.libraries.jars" /></path>
<target name="couchbase-jar" depends="compile">
- <jar destfile="bin/couchbase.jar" basedir="bin/classes" excludes="**/R*"/>
+ <jar destfile="bin/couchbase.jar">
+ <fileset dir="bin/classes">
+ <include name="**/*"/>
+ <exclude name="**/R*"/>
+ </fileset>
+ <fileset dir="src">
+ <include name="**/*"/>
+ </fileset>
+ </jar>
</target>
<target name="dist" depends="couchbase-jar">
View
12 doc/README.txt
@@ -18,13 +18,13 @@ Now that your project supports Couchbase, starting Cocuhbase is accomplished by
1. Create an instance of ICouchbaseDelegate, you can implement these methods to respond to Couchbase events
- private final ICouchbaseDelegate mCallback = new ICouchbaseDelegate.Stub() {
+ private final ICouchbaseDelegate mDelegate = new ICouchbaseDelegate() {
@Override
public void couchbaseStarted(String host, int port) {}
-
+
@Override
public void installing(int completed, int total) {}
-
+
@Override
public void exit(String error) {}
};
@@ -52,7 +52,11 @@ Now that your project supports Couchbase, starting Cocuhbase is accomplished by
## Examples
-For examples please look at https://github.com/couchbase/Android-EmptyApp
+For examples please look at:
+
+* https://github.com/couchbase/Android-EmptyApp
+* https://github.com/daleharvey/Android-MobileFuton
+* https://github.com/couchbaselabs/AndroidGrocerySync
## Join us
View
10 src/com/couchbase/android/CouchbaseMobile.java
@@ -8,9 +8,6 @@
import java.io.OutputStream;
import java.util.ArrayList;
-import com.couchbase.android.ICouchbaseDelegate;
-import com.couchbase.android.ICouchbaseService;
-
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -18,7 +15,6 @@
import android.content.res.AssetManager;
import android.os.Environment;
import android.os.IBinder;
-import android.os.RemoteException;
/*
* This is the minimal API for building against Android-Couchbase, its
@@ -141,12 +137,8 @@ private void copyIffNotExists(String name, File destination) throws IOException
private final static ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className, final IBinder service) {
- try {
- couchbaseService = ICouchbaseService.Stub.asInterface(service);
+ couchbaseService = (ICouchbaseService)service;
couchbaseService.startCouchbase(couchbaseDelegate, releaseName);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
}
@Override
View
57 src/com/couchbase/android/CouchbaseService.java
@@ -20,14 +20,12 @@
import android.app.Service;
import android.content.Intent;
+import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
-import android.os.RemoteException;
import android.util.Log;
-import com.couchbase.android.ICouchbaseDelegate;
-import com.couchbase.android.ICouchbaseService;
import com.google.ase.Exec;
public class CouchbaseService extends Service {
@@ -63,30 +61,27 @@
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
- try {
- switch (msg.what) {
- case ERROR:
- Exception e = (Exception) msg.obj;
- StringWriter sw = new StringWriter();
- e.printStackTrace(new PrintWriter(sw));
- String stacktrace = sw.toString();
- if (couchbaseDelegate != null) {
- couchbaseDelegate.exit(stacktrace);
- }
- break;
- case PROGRESS:
- couchbaseDelegate.installing(msg.arg1, msg.arg2);
- break;
- case COMPLETE:
- startCouchbaseService();
- break;
- case COUCHBASE_STARTED:
- URL url = (URL) msg.obj;
- couchbaseDelegate.couchbaseStarted(url.getHost(), url.getPort());
- break;
+
+ switch (msg.what) {
+ case ERROR:
+ Exception e = (Exception) msg.obj;
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ String stacktrace = sw.toString();
+ if (couchbaseDelegate != null) {
+ couchbaseDelegate.exit(stacktrace);
}
- } catch (RemoteException e) {
- e.printStackTrace();
+ break;
+ case PROGRESS:
+ couchbaseDelegate.installing(msg.arg1, msg.arg2);
+ break;
+ case COMPLETE:
+ startCouchbaseService();
+ break;
+ case COUCHBASE_STARTED:
+ URL url = (URL) msg.obj;
+ couchbaseDelegate.couchbaseStarted(url.getHost(), url.getPort());
+ break;
}
}
};
@@ -113,10 +108,10 @@ public IBinder onBind(Intent intent) {
/*
* implements the callbacks that clients can call into the couchbase service
*/
- public class CouchbaseServiceImpl extends ICouchbaseService.Stub {
+ public class CouchbaseServiceImpl extends Binder implements ICouchbaseService {
@Override
- public void startCouchbase(ICouchbaseDelegate cb, final String pkg) throws RemoteException {
+ public void startCouchbase(ICouchbaseDelegate cb, final String pkg) {
couchbaseDelegate = cb;
if (!CouchbaseInstaller.checkInstalled(pkg)) {
installCouchbase(pkg);
@@ -132,13 +127,13 @@ public void startCouchbase(ICouchbaseDelegate cb, final String pkg) throws Remot
/*
*/
@Override
- public void stopCouchbase() throws RemoteException {
+ public void stopCouchbase() {
stop();
}
};
/* once couchbase has started we need to notify the waiting client */
- void couchbaseStarted() throws RemoteException {
+ void couchbaseStarted() {
couchbaseDelegate.couchbaseStarted(url.getHost(), url.getPort());
}
@@ -246,4 +241,4 @@ public static String join(Collection<String> s, String delimiter) {
return buffer.toString();
}
-}
+}
View
12 src/com/couchbase/android/ICouchbaseDelegate.aidl
@@ -1,12 +0,0 @@
-package com.couchbase.android;
-
-interface ICouchbaseDelegate
-{
- /* Callback to notify when Couchbase has started */
- void couchbaseStarted(String host, int port);
-
- /* Callback for notifications on how the Couchbase install is progressing */
- void installing(int completed, int total);
-
- void exit(String error);
-}
View
33 src/com/couchbase/android/ICouchbaseDelegate.java
@@ -0,0 +1,33 @@
+package com.couchbase.android;
+
+/**
+ *
+ *
+ *
+ */
+public interface ICouchbaseDelegate
+{
+
+ /**
+ * Callback to notify when Couchbase has started
+ *
+ * @param host the host Couchbase is listening on
+ * @param port the port Couchbase is listening on
+ */
+ void couchbaseStarted(String host, int port);
+
+ /**
+ * Callback for notifications on how the Couchbase install is progressing
+ *
+ * @param completed the number of files installed
+ * @param total the total number of files to install
+ */
+ void installing(int completed, int total);
+
+ /**
+ * Callback for notification that Couchbase has exited
+ *
+ * @param error an error message describing the reason Couchbase exited
+ */
+ void exit(String error);
+}
View
0  .../couchbase/android/ICouchbaseService.aidl → .../couchbase/android/ICouchbaseService.java
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.