{"id":808,"date":"2016-10-04T15:00:00","date_gmt":"2016-10-04T15:00:00","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/"},"modified":"2016-10-04T15:00:00","modified_gmt":"2016-10-04T15:00:00","slug":"using-couchbase-lite-in-a-java-gluon-application","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/pt\/using-couchbase-lite-in-a-java-gluon-application\/","title":{"rendered":"Using Couchbase Lite in a Java Gluon Application"},"content":{"rendered":"\n<p>I recently wrote about building desktop applications with <a href=\"https:\/\/www.couchbase.com\/blog\/using-couchbase-in-a-javafx-desktop-application\/\">Couchbase Lite and JavaFX<\/a>. As demonstrated Couchbase makes an excellent solution for data storage and sync in a desktop application because of the Java SDK available. However, I realize JavaFX is not for everyone.<\/p>\n\n\n\n<p>There is another, similar framework for building desktop applications in Java. It is called Gluon, and it offers support for Android and iOS applications as well. However, we&#8217;re strictly looking at desktop in this example.<\/p>\n\n\n\n<p>We&#8217;re going to see how to create a Gluon desktop application using nearly the same code that was found in our previous JavaFX example.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Requirements<\/h2>\n\n\n\n<p>There are a few requirements towards building a Gluon application that uses Couchbase.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>JDK 1.7+<\/li>\n\n\n<li>IntelliJ IDEA<\/li>\n\n\n<li>Couchbase Sync Gateway<\/li>\n\n<\/ul>\n\n\n\n<p>I don&#8217;t typically make this a requirement, but it is far easier to create a Gluon application with an IDE like IntelliJ, thus why it is in the list. There is a plugin for IntelliJ that will construct a Gluon project with Gradle and everything you need.<\/p>\n\n\n\n<p>While Couchbase Sync Gateway isn&#8217;t truly a requirement, it is necessary if you want to add synchronization support between your application and Couchbase Server \/ other platforms and devices.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating a New Gluon Project<\/h2>\n\n\n\n<p>If you decide to use IntelliJ to build your project, make sure you&#8217;ve already downloaded the Gluon plugin as described <a href=\"https:\/\/gluonhq.com\/the-new-gluon-plugin-for-intellij-idea\/\">here<\/a>.<\/p>\n\n\n\n<p>Using IntelliJ, create a new project, but choose to create a <strong>Gluon Desktop &#8211; Multiple View Project with FXML<\/strong> project as seen below.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/cb-gluon-desktop-1.png\"><\/p>\n\n\n\n<p>Ultimately, it is up to you where to go from here, but to stay as close as possible to this guide, give your project a <strong>com.couchbaselabs<\/strong> package name and <strong>gluon<\/strong> main class.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/cb-gluon-desktop-2.png\"><\/p>\n\n\n\n<p>Everything that follows can be left as the default as we&#8217;re only going to make a two page application with Gluon. When we&#8217;re done, hopefully we&#8217;re left with a file and directory structure that looks like the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\ngradle\r\n    wrapper\r\nsrc\r\n    main\r\n        java\r\n            com\r\n                couchbaselabs\r\n                    views\r\n                        PrimaryPresenter.java\r\n                        PrimaryView.java\r\n                        SecondaryPresenter.java\r\n                        SecondaryView.java\r\n                    CouchbaseSingleton.java\r\n                    Todo.java\r\n                    gluon.java\r\n    resources\r\n        couchbaselabs\r\n            views\r\n                primary.fxml\r\n                primary.css\r\n                secondary.fxml\r\n                secondary.css\r\n            style.css\r\n        icon.png\r\nbuild.gradle\r\ngradlew\r\ngradlew.bat\r\n<\/code><\/pre>\n\n\n\n<p>You&#8217;ll notice that I did create a few extra files in there such as <strong>CouchbaseSingleton.java<\/strong> and <strong>Todo.java<\/strong>.<\/p>\n\n\n\n<p>Essentially we have XML views and controllers to go with those views. This is very similar to what we saw in a <a href=\"https:\/\/www.couchbase.com\/blog\/using-couchbase-in-a-javafx-desktop-application\/\">JavaFX application<\/a>. When it comes to designing those views, we have a few options. We can use raw XML, or we can use <a href=\"https:\/\/gluonhq.com\/labs\/scene-builder\/\">SceneBuilder<\/a>. Now this SceneBuilder is not to be confused with JavaFX SceneBuilder. I made this mistake and was banging my head for quite a bit of time. The version we want will support Gluon applications.<\/p>\n\n\n\n<p>Before we start adding application code, we should add our dependencies to the project Gradle file. If you&#8217;re unfamiliar with Gradle, it does the same job as Maven or Ant. The syntax is different, but I personally find it a little cleaner. Open the project&#8217;s <strong>build.gradle<\/strong> and include the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\nbuildscript {\r\n    repositories {\r\n        jcenter()\r\n    }\r\n    dependencies {\r\n        classpath &#039;org.javafxports:jfxmobile-plugin:1.0.8&#039;\r\n    }\r\n}\r\n\r\napply plugin: &#039;org.javafxports.jfxmobile&#039;\r\n\r\nrepositories {\r\n    jcenter()\r\n    maven {\r\n        url &#039;https:\/\/nexus.gluonhq.com\/nexus\/content\/repositories\/releases&#039;\r\n    }\r\n}\r\n\r\nmainClassName = &#039;com.couchbaselabs.gluon&#039;\r\n\r\ndependencies {\r\n    compile &#039;com.gluonhq:charm:3.0.0&#039;\r\n    compile &#039;com.couchbase.lite:couchbase-lite-java:1.3.0&#039;\r\n    desktopRuntime &#039;com.gluonhq:charm-desktop:3.0.0&#039;\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>What&#8217;s particularly important here are the dependencies:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\ndependencies {\r\n    compile &#039;com.gluonhq:charm:3.0.0&#039;\r\n    compile &#039;com.couchbase.lite:couchbase-lite-java:1.3.0&#039;\r\n    desktopRuntime &#039;com.gluonhq:charm-desktop:3.0.0&#039;\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>This will include the Couchbase Lite library as well as the desktop application runtime for Gluon.<\/p>\n\n\n\n<p>With the project ready to go, we can start developing the application.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Designing the Couchbase Data Layer<\/h2>\n\n\n\n<p>When working with Couchbase it is a good idea to create a singleton instance of it. This means we&#8217;re going to use the same open instance throughout the entire application, until we decide to close it.<\/p>\n\n\n\n<p>Open the project&#8217;s <strong>src\/main\/java\/com\/couchbaselabs\/CouchbaseSingleton.java<\/strong> file and include the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\npackage com.couchbaselabs;\r\n\r\nimport com.couchbase.lite.*;\r\nimport com.couchbase.lite.replicator.Replication;\r\n\r\nimport java.net.URL;\r\nimport java.util.ArrayList;\r\nimport java.util.HashMap;\r\nimport java.util.Iterator;\r\nimport java.util.Map;\r\n\r\npublic class CouchbaseSingleton {\r\n\r\n    private Manager manager;\r\n    private Database database;\r\n    private Replication pushReplication;\r\n    private Replication pullReplication;\r\n\r\n    private static CouchbaseSingleton instance = null;\r\n\r\n    private CouchbaseSingleton() {\r\n        try {\r\n            this.manager = new Manager(new JavaContext(&quot;data&quot;), Manager.DEFAULT_OPTIONS);\r\n            this.database = this.manager.getDatabase(&quot;fx-project&quot;);\r\n            View todoView = database.getView(&quot;todos&quot;);\r\n            todoView.setMap(new Mapper() {\r\n                @Override\r\n                public void map(Map&lt;String, Object&gt; document, Emitter emitter) {\r\n                    emitter.emit(document.get(&quot;_id&quot;), document);\r\n                }\r\n            }, &quot;1&quot;);\r\n        } catch (Exception e) {\r\n            e.printStackTrace();\r\n        }\r\n    }\r\n\r\n    public static CouchbaseSingleton getInstance() {\r\n        if(instance == null) {\r\n            instance = new CouchbaseSingleton();\r\n        }\r\n        return instance;\r\n    }\r\n\r\n    public Database getDatabase() {\r\n        return this.database;\r\n    }\r\n\r\n    public void startReplication(URL gateway, boolean continuous) {\r\n        this.pushReplication = this.database.createPushReplication(gateway);\r\n        this.pullReplication = this.database.createPullReplication(gateway);\r\n        this.pushReplication.setContinuous(continuous);\r\n        this.pullReplication.setContinuous(continuous);\r\n        this.pushReplication.start();\r\n        this.pullReplication.start();\r\n    }\r\n\r\n    public void stopReplication() {\r\n        this.pushReplication.stop();\r\n        this.pullReplication.stop();\r\n    }\r\n\r\n    public Todo save(Todo todo) {\r\n        Map&lt;String, Object&gt; properties = new HashMap&lt;String, Object&gt;();\r\n        Document document = this.database.createDocument();\r\n        properties.put(&quot;type&quot;, &quot;todo&quot;);\r\n        properties.put(&quot;title&quot;, todo.getTitle());\r\n        properties.put(&quot;description&quot;, todo.getDescription());\r\n        try {\r\n            todo.setDocumentId(document.putProperties(properties).getDocument().getId());\r\n        } catch (Exception e) {\r\n            e.printStackTrace();\r\n        }\r\n        return todo;\r\n    }\r\n\r\n    public ArrayList query() {\r\n        ArrayList results = new ArrayList();\r\n        try {\r\n            View todoView = this.database.getView(&quot;todos&quot;);\r\n            Query query = todoView.createQuery();\r\n            QueryEnumerator result = query.run();\r\n            Document document = null;\r\n            for (Iterator it = result; it.hasNext(); ) {\r\n                QueryRow row = it.next();\r\n                document = row.getDocument();\r\n                results.add(new Todo(document.getId(), (String) document.getProperty(&quot;title&quot;), (String) document.getProperty(&quot;description&quot;)));\r\n            }\r\n        } catch (Exception e) {\r\n            e.printStackTrace();\r\n        }\r\n        return results;\r\n    }\r\n\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>If you saw the JavaFX application I built previously, you&#8217;ll notice that this singleton is the same between the two projects. You can even use a similar version for Android.<\/p>\n\n\n\n<p>In the <code>CouchbaseSingleton<\/code> constructor method we are creating and opening a local database called <strong>fx-project<\/strong>. This database will be used throughout the application. We are also creating our Couchbase Lite view for querying. This <code>todos<\/code> view will emit a key-value pair of document id and document for every document in the local database.<\/p>\n\n\n\n<p>The constructor method is private, meaning we don&#8217;t want the user to be able to instantiate an object from it. Instead we want to use a static <code>getInstance<\/code> method to get the job done.<\/p>\n\n\n\n<p>While we won&#8217;t worry about replication until later in the guide, we do want to lay the foundation. The <code>startReplication<\/code> method will allow us to define bi-directional sync with a Sync Gateway and the <code>stopReplication<\/code> method will allow us to stop replication, maybe when the application closes.<\/p>\n\n\n\n<p>Now we have our functions for saving and loading data.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\npublic Todo save(Todo todo) {\r\n    Map&lt;String, Object&gt; properties = new HashMap&lt;String, Object&gt;();\r\n    Document document = this.database.createDocument();\r\n    properties.put(&quot;type&quot;, &quot;todo&quot;);\r\n    properties.put(&quot;title&quot;, todo.getTitle());\r\n    properties.put(&quot;description&quot;, todo.getDescription());\r\n    try {\r\n        todo.setDocumentId(document.putProperties(properties).getDocument().getId());\r\n    } catch (Exception e) {\r\n        e.printStackTrace();\r\n    }\r\n    return todo;\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>In the <code>save<\/code> method we are accepting a custom <code>Todo<\/code> object. This object really just contains an id, a title, and a description. The class looks something like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\npackage com.couchbaselabs;\r\n\r\nimport java.util.*;\r\n\r\npublic class Todo {\r\n\r\n    private String documentId;\r\n    private String title;\r\n    private String description;\r\n\r\n    public Todo(String documentId, String title, String description) {\r\n        this.documentId = documentId;\r\n        this.title = title;\r\n        this.description = description;\r\n    }\r\n\r\n    public Todo(String title, String description) {\r\n        this.documentId = UUID.randomUUID().toString();\r\n        this.title = title;\r\n        this.description = description;\r\n    }\r\n\r\n    public void setDocumentId(String documentId) {\r\n        this.documentId = documentId;\r\n    }\r\n\r\n    public String getDocumentId() {\r\n        return this.documentId;\r\n    }\r\n\r\n    public String getTitle() {\r\n        return this.title;\r\n    }\r\n\r\n    public String getDescription() {\r\n        return this.description;\r\n    }\r\n\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>The above class is found in the <strong>src\/main\/java\/com\/couchbaselabs\/Todo.java<\/strong> file. What we&#8217;re doing is actually taking the object and adding it as properties to a Couchbase NoSQL document. After we save the document and obtain an id, we return the same document with the id included.<\/p>\n\n\n\n<p>The query function will execute the view that we created earlier and add each of the result items to an array of <code>Todo<\/code> object, bringing our database singleton to an end.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating a View for Listing Data<\/h2>\n\n\n\n<p>We are going to be creating an application that uses multiple Gluon views instead of trying to slap everything into the same view. This is not to be confused with Couchbase Lite Views which are on the topic of data, not UI.<\/p>\n\n\n\n<p>The default view will be the first view that comes up when we launch the application. This view will show a list of all our todo elements. If not using SceneBuilder, the XML markup found in <strong>src\/main\/resources\/com\/couchbaselabs\/views\/primary.fxml<\/strong> would look like the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\n\r\n\r\n\r\n\r\n<\/code><\/pre>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\n\r\n<\/code><\/pre>\n\n\n\n<p>The view that comes out of this will look like the following:<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/cb-gluon-desktop-3.png\"><\/p>\n\n\n\n<p>You&#8217;ll see in the image that there is a navigation bar with a button, but it doesn&#8217;t appear in the XML layout. The layout instead only contains the list view. However, the XML does reference our <strong>src\/main\/java\/com\/couchbaselabs\/views\/PrimaryPresenter.java<\/strong> file. This is the file where we not only define the navigation bar, but any logic that powers the particular view.<\/p>\n\n\n\n<p>The <strong>src\/main\/java\/com\/couchbaselabs\/views\/PrimaryPresenter.java<\/strong> file will hold a lot of resemblence to our JavaFX project, with the differences being in the navigation component.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\npackage com.couchbaselabs.views;\r\n\r\nimport com.couchbaselabs.CouchbaseSingleton;\r\nimport com.couchbaselabs.Todo;\r\nimport com.couchbase.lite.Database;\r\nimport com.couchbase.lite.Document;\r\nimport com.couchbaselabs.gluon;\r\nimport com.gluonhq.charm.glisten.application.MobileApplication;\r\nimport com.gluonhq.charm.glisten.control.AppBar;\r\nimport com.gluonhq.charm.glisten.mvc.View;\r\nimport com.gluonhq.charm.glisten.visual.MaterialDesignIcon;\r\nimport javafx.application.Platform;\r\nimport javafx.collections.ObservableList;\r\nimport javafx.fxml.FXML;\r\nimport javafx.scene.control.ListCell;\r\nimport javafx.scene.control.ListView;\r\nimport javafx.util.Callback;\r\n\r\npublic class PrimaryPresenter {\r\n\r\n    private CouchbaseSingleton couchbase;\r\n\r\n    @FXML\r\n    private View primary;\r\n\r\n    @FXML\r\n    private ListView fxListView;\r\n\r\n    public void initialize() {\r\n        try {\r\n            this.couchbase = CouchbaseSingleton.getInstance();\r\n            fxListView.getItems().addAll(this.couchbase.query());\r\n            this.couchbase.getDatabase().addChangeListener(new Database.ChangeListener() {\r\n                @Override\r\n                public void changed(Database.ChangeEvent event) {\r\n                    for(int i = 0; i &lt; event.getChanges().size(); i++) {\r\n                        final Document retrievedDocument = couchbase.getDatabase().getDocument(event.getChanges().get(i).getDocumentId());\r\n                        Platform.runLater(new Runnable() {\r\n                            @Override\r\n                            public void run() {\r\n                                int documentIndex = indexOfByDocumentId(retrievedDocument.getId(), fxListView.getItems());\r\n                                for (int j = 0; j &lt; fxListView.getItems().size(); j++) { if (((Todo) fxListView.getItems().get(j)).getDocumentId().equals(retrievedDocument.getId())) { documentIndex = j; break; } } if (retrievedDocument.isDeleted()) { if (documentIndex &gt; -1) {\r\n                                        fxListView.getItems().remove(documentIndex);\r\n                                    }\r\n                                } else {\r\n                                    if (documentIndex == -1) {\r\n                                        fxListView.getItems().add(new Todo(retrievedDocument.getId(), (String) retrievedDocument.getProperty(&quot;title&quot;), (String) retrievedDocument.getProperty(&quot;description&quot;)));\r\n                                    } else {\r\n                                        fxListView.getItems().remove(documentIndex);\r\n                                        fxListView.getItems().add(new Todo(retrievedDocument.getId(), (String) retrievedDocument.getProperty(&quot;title&quot;), (String) retrievedDocument.getProperty(&quot;description&quot;)));\r\n                                    }\r\n                                }\r\n                            }\r\n                        });\r\n                    }\r\n                }\r\n            });\r\n        } catch (Exception e) {\r\n            e.printStackTrace();\r\n        }\r\n        fxListView.setCellFactory(new Callback&lt;ListView, ListCell&gt;() {\r\n            @Override\r\n            public ListCell call(ListView p) {\r\n                ListCell cell = new ListCell() {\r\n                    @Override\r\n                    protected void updateItem(Todo t, boolean bln) {\r\n                        super.updateItem(t, bln);\r\n                        if (t != null) {\r\n                            setText(t.getTitle());\r\n                        }\r\n                    }\r\n                };\r\n                return cell;\r\n            }\r\n        });\r\n        primary.showingProperty().addListener((obs, oldValue, newValue) -&gt; {\r\n            if (newValue) {\r\n                AppBar appBar = MobileApplication.getInstance().getAppBar();\r\n                appBar.setTitleText(&quot;Couchbase Todo - List&quot;);\r\n                appBar.getActionItems().add(MaterialDesignIcon.ADD.button(e -&gt;\r\n                        MobileApplication.getInstance().switchView(gluon.SECONDARY_VIEW)\r\n                ));\r\n            }\r\n        });\r\n    }\r\n\r\n    private int indexOfByDocumentId(String needle, ObservableList haystack) {\r\n        int result = -1;\r\n        for(int i = 0; i &lt; haystack.size(); i++) {\r\n            if(haystack.get(i).getDocumentId().equals(needle)) {\r\n                result = i;\r\n                break;\r\n            }\r\n        }\r\n        return result;\r\n    }\r\n\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>In the above file we have the list view property bound to the actual list view in the XML. The code that really matters, however, is the code found in the <code>initialize<\/code> method. In it we do three core things.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\nfxListView.setCellFactory(new Callback&lt;ListView, ListCell&gt;() {\r\n    @Override\r\n    public ListCell call(ListView p) {\r\n        ListCell cell = new ListCell() {\r\n            @Override\r\n            protected void updateItem(Todo t, boolean bln) {\r\n                super.updateItem(t, bln);\r\n                if (t != null) {\r\n                    setText(t.getTitle());\r\n                }\r\n            }\r\n        };\r\n        return cell;\r\n    }\r\n});\r\n<\/code><\/pre>\n\n\n\n<p>In the above code we define how the data will appear in the list. By default it only accepts string data, so we override it to take the title from our <code>Todo<\/code> objects.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\nprimary.showingProperty().addListener((obs, oldValue, newValue) -&gt; {\r\n    if (newValue) {\r\n        AppBar appBar = MobileApplication.getInstance().getAppBar();\r\n        appBar.setTitleText(&quot;Couchbase Todo - List&quot;);\r\n        appBar.getActionItems().add(MaterialDesignIcon.ADD.button(e -&gt;\r\n                MobileApplication.getInstance().switchView(gluon.SECONDARY_VIEW)\r\n        ));\r\n    }\r\n});\r\n<\/code><\/pre>\n\n\n\n<p>In the above listener we set the title of our navigation bar as well as the button. When the button is pressed, the view will change to our secondary view.<\/p>\n\n\n\n<p>Finally it leaves us with running the initial data query and populating the list, as well as listening for new data as it comes in. Should changes come in, they will be iterated over and the indicators will be reviewed on every changed document. If there was a delete indictator, the data will be removed from the list view. If there was a change, the data from the list view will be removed, then replaced. Otherwise the data will only be added. Since the listener operates on a background thread, changes to the UI must be done within the <code>Platform.runLater<\/code>.<\/p>\n\n\n\n<p>This brings us to the second and final view.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating a View for Saving Data<\/h2>\n\n\n\n<p>The second view will have a form and is responsible for user input to be added to the database and displayed in the previous view. The XML markup that powers this view will look like the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n   \r\n      \r\n         \r\n            \r\n                     &lt;\/children&gt;\r\n      &lt;\/VBox&gt;\r\n   &lt;\/top&gt;\r\n   &lt;padding&gt;\r\n      &lt;Insets bottom=&quot;10.0&quot; left=&quot;10.0&quot; right=&quot;10.0&quot; top=&quot;10.0&quot; \/&gt;\r\n   &lt;\/padding&gt;\r\n&lt;\/View&gt;\r\n&lt;\/code&gt;\r\n&lt;\/pre&gt;\r\n&lt;p&gt;The XML above is found in the &lt;strong&gt;src\/main\/resources\/com\/couchbaselabs\/views\/secondary.fxml&lt;\/strong&gt; file and the view itself looks like the following:&lt;\/p&gt;\r\n&lt;p&gt;&lt;img src=&quot;\/wp-content\/original-assets\/2016\/october\/using-couchbase-lite-in-a-java-gluon-application\/cb-gluon-desktop-4.png&quot; \/&gt;&lt;\/p&gt;\r\n&lt;p&gt;Notice that there are two &lt;code&gt;TextField&lt;\/code&gt; inputs. They will be important in the &lt;strong&gt;src\/main\/java\/com\/couchbaselabs\/views\/SecondaryPresenter.java&lt;\/strong&gt; file referenced in the XML. This file contains the following code:&lt;\/p&gt;\r\n&lt;pre&gt;\r\n&lt;code&gt;\r\npackage com.couchbaselabs.views;\r\n\r\nimport com.couchbaselabs.CouchbaseSingleton;\r\nimport com.couchbaselabs.Todo;\r\nimport com.gluonhq.charm.glisten.animation.BounceInRightTransition;\r\nimport com.gluonhq.charm.glisten.application.MobileApplication;\r\nimport com.gluonhq.charm.glisten.control.AppBar;\r\nimport com.gluonhq.charm.glisten.layout.layer.FloatingActionButton;\r\nimport com.gluonhq.charm.glisten.mvc.View;\r\nimport com.gluonhq.charm.glisten.visual.MaterialDesignIcon;\r\nimport javafx.fxml.FXML;\r\nimport javafx.scene.control.Alert;\r\nimport javafx.scene.control.TextArea;\r\nimport javafx.scene.control.TextField;\r\n\r\npublic class SecondaryPresenter {\r\n\r\n    private CouchbaseSingleton couchbase;\r\n\r\n    @FXML\r\n    private View secondary;\r\n\r\n    @FXML\r\n    private TextField fxTitle;\r\n\r\n    @FXML\r\n    private TextArea fxDescription;\r\n\r\n    public void initialize() {\r\n        this.couchbase = CouchbaseSingleton.getInstance();\r\n        secondary.setShowTransitionFactory(BounceInRightTransition::new);\r\n\r\n        secondary.getLayers().add(new FloatingActionButton(MaterialDesignIcon.SAVE.text,\r\n            e -&gt; save()\r\n        ));\r\n\r\n        secondary.showingProperty().addListener((obs, oldValue, newValue) -&gt; {\r\n            if (newValue) {\r\n                AppBar appBar = MobileApplication.getInstance().getAppBar();\r\n                appBar.setTitleText(&quot;Couchbase Todo - Create&quot;);\r\n            }\r\n        });\r\n    }\r\n\r\n    private void save() {\r\n        if(!fxTitle.getText().equals(&quot;&quot;) &amp;&amp; !fxDescription.getText().equals(&quot;&quot;)) {\r\n            couchbase.save(new Todo(fxTitle.getText(), fxDescription.getText()));\r\n            fxTitle.setText(&quot;&quot;);\r\n            fxDescription.setText(&quot;&quot;);\r\n            MobileApplication.getInstance().switchToPreviousView();\r\n        } else {\r\n            Alert alert = new Alert(Alert.AlertType.INFORMATION);\r\n            alert.setTitle(&quot;Missing Information&quot;);\r\n            alert.setHeaderText(null);\r\n            alert.setContentText(&quot;Both a title and description are required for this example.&quot;);\r\n            alert.showAndWait();\r\n        }\r\n    }\r\n\r\n}\r\n&lt;\/code&gt;\r\n&lt;\/pre&gt;\r\n&lt;p&gt;The input fields are mapped to this controller, but what really matters here is the code for adding the floating action button and setting the navigation bar title.&lt;\/p&gt;\r\n&lt;pre&gt;\r\n&lt;code&gt;\r\nsecondary.getLayers().add(new FloatingActionButton(MaterialDesignIcon.SAVE.text,\r\n    e -&gt; save()\r\n));\r\n\r\nsecondary.showingProperty().addListener((obs, oldValue, newValue) -&gt; {\r\n    if (newValue) {\r\n        AppBar appBar = MobileApplication.getInstance().getAppBar();\r\n        appBar.setTitleText(&quot;Couchbase Todo - Create&quot;);\r\n    }\r\n});\r\n&lt;\/code&gt;\r\n&lt;\/pre&gt;\r\n&lt;p&gt;When the floating action button is clicked, the &lt;code&gt;save&lt;\/code&gt; method is called. In the &lt;code&gt;save&lt;\/code&gt; method we check to make sure the input fields are not blank and if they aren&#039;t, save the data and navigate backwards in the stack to the previous view.&lt;\/p&gt;\r\n&lt;h2&gt;Syncing Data with Couchbase Sync Gateway&lt;\/h2&gt;\r\n&lt;p&gt;Up until now, every part of our Gluon application was built for offline local use. However, including synchronization support into the mix is not only useful, but incredibly easy.&lt;\/p&gt;\r\n&lt;p&gt;At this point I&#039;m going to assume you&#039;ve downloaded and installed Couchbase Sync Gateway. Before we run it, we need to create a configuration file. Create a JSON file with the following:&lt;\/p&gt;\r\n&lt;pre&gt;\r\n&lt;code&gt;\r\n{\r\n    &quot;log&quot;:[&quot;CRUD+&quot;, &quot;REST+&quot;, &quot;Changes+&quot;, &quot;Attach+&quot;],\r\n    &quot;databases&quot;: {\r\n        &quot;fx-example&quot;: {\r\n            &quot;server&quot;:&quot;walrus:&quot;,\r\n            &quot;sync&quot;:`\r\n                function (doc) {\r\n                    channel (doc.channels);\r\n                }\r\n            `,\r\n            &quot;users&quot;: {\r\n                &quot;GUEST&quot;: {\r\n                    &quot;disabled&quot;: false,\r\n                    &quot;admin_channels&quot;: [&quot;*&quot;]\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n&lt;\/code&gt;\r\n&lt;\/pre&gt;\r\n&lt;p&gt;The above configuration file is one of the most simplest you can make for Sync Gateway. You&#039;re creating a partition called &lt;strong&gt;fx-example&lt;\/strong&gt; within the in-memory database &lt;strong&gt;walrus&lt;\/strong&gt; and you&#039;re accepting all documents from everyone with no read or write permissions.&lt;\/p&gt;\r\n&lt;p&gt;Running this configuration with Sync Gateway won&#039;t get us very far yet because we haven&#039;t activated sync support in our application. Open the project&#039;s &lt;strong&gt;src\/main\/java\/com\/couchbaselabs\/gluon.java&lt;\/strong&gt; file and include the following:&lt;\/p&gt;\r\n&lt;pre&gt;\r\n&lt;code&gt;\r\npackage com.couchbaselabs;\r\n\r\nimport com.couchbaselabs.views.PrimaryView;\r\nimport com.couchbaselabs.views.SecondaryView;\r\nimport com.gluonhq.charm.glisten.application.MobileApplication;\r\nimport com.gluonhq.charm.glisten.visual.Swatch;\r\nimport javafx.scene.Scene;\r\n\r\n\r\npublic class gluon extends MobileApplication {\r\n\r\n    public static final String PRIMARY_VIEW = HOME_VIEW;\r\n    public static final String SECONDARY_VIEW = &quot;Secondary View&quot;;\r\n    public CouchbaseSingleton couchbase;\r\n\r\n    @Override\r\n    public void init() {\r\n        addViewFactory(PRIMARY_VIEW, () -&gt; new PrimaryView(PRIMARY_VIEW).getView());\r\n        addViewFactory(SECONDARY_VIEW, () -&gt; new SecondaryView(SECONDARY_VIEW).getView());\r\n    }\r\n\r\n    @Override\r\n    public void postInit(Scene scene) {\r\n        Swatch.BLUE.assignTo(scene);\r\n\r\n        scene.getStylesheets().add(gluon.class.getResource(&quot;style.css&quot;).toExternalForm());\r\n        try {\r\n            this.couchbase = CouchbaseSingleton.getInstance();\r\n            this.couchbase.startReplication(new URL(&quot;https:\/\/localhost:4984\/fx-example\/&quot;), true);\r\n        } catch (Exception e) {\r\n            e.printStackTrace();\r\n        }\r\n\r\n    }\r\n}\r\n&lt;\/code&gt;\r\n&lt;\/pre&gt;\r\n&lt;p&gt;Really we only care about the &lt;code&gt;startReplication&lt;\/code&gt; line in the &lt;code&gt;postInit&lt;\/code&gt; method. Once we call it, replication will happen in both directions, continuously.&lt;\/p&gt;\r\n&lt;h2&gt;Conclusion&lt;\/h2&gt;\r\n&lt;p&gt;You just saw how to create a Java desktop application with Gluon and Couchbase. Using Gradle you can build and run the application and with a few revisions it can be converted to Android as well.&lt;\/p&gt;\r\n&lt;p&gt;The full source code to this project can be found on GitHub &lt;a href=&quot;https:\/\/github.com\/couchbaselabs\/couchbase-lite-gluon-example&quot;&gt;here&lt;\/a&gt;.&lt;\/p&gt;\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I recently wrote about building desktop applications with Couchbase Lite and JavaFX. As demonstrated Couchbase makes an excellent solution for data storage and sync in a desktop application because of the Java SDK available. However, I realize JavaFX is not for everyone. There is another, similar framework for building desktop applications in Java. It is [&hellip;]<\/p>\n","protected":false},"author":63,"featured_media":18,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[9,144,104],"tags":[203],"ppma_author":[148],"class_list":["post-808","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-couchbase-mobile","category-java","category-sync-gateway","tag-cross-platform"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.6 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Using Couchbase Lite in a Java Gluon Application - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/pt\/using-couchbase-lite-in-a-java-gluon-application\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Couchbase Lite in a Java Gluon Application\" \/>\n<meta property=\"og:description\" content=\"I recently wrote about building desktop applications with Couchbase Lite and JavaFX. As demonstrated Couchbase makes an excellent solution for data storage and sync in a desktop application because of the Java SDK available. However, I realize JavaFX is not for everyone. There is another, similar framework for building desktop applications in Java. It is [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/pt\/using-couchbase-lite-in-a-java-gluon-application\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/thepolyglotdeveloper\" \/>\n<meta property=\"article:published_time\" content=\"2016-10-04T15:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Nic Raboy, Developer Advocate, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@nraboy\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nic Raboy, Developer Advocate, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"16 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/\"},\"author\":{\"name\":\"Nic Raboy, Developer Advocate, Couchbase\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/bb545ebe83bb2d12f91095811d0a72e1\"},\"headline\":\"Using Couchbase Lite in a Java Gluon Application\",\"datePublished\":\"2016-10-04T15:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/\"},\"wordCount\":1319,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"keywords\":[\"cross platform\"],\"articleSection\":[\"Couchbase Mobile\",\"Java\",\"Sync Gateway\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/\",\"name\":\"Using Couchbase Lite in a Java Gluon Application - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2016-10-04T15:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-couchbase-lite-in-a-java-gluon-application\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Couchbase Lite in a Java Gluon Application\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"width\":\"1024\",\"height\":\"1024\",\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/bb545ebe83bb2d12f91095811d0a72e1\",\"name\":\"Nic Raboy, Developer Advocate, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g8863514d8bed0cf6080f23db40e00354\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g\",\"caption\":\"Nic Raboy, Developer Advocate, Couchbase\"},\"description\":\"Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in Java, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Apache Cordova. Nic writes about his development experiences related to making web and mobile development easier to understand.\",\"sameAs\":[\"https:\\\/\\\/www.thepolyglotdeveloper.com\",\"https:\\\/\\\/www.facebook.com\\\/thepolyglotdeveloper\",\"https:\\\/\\\/x.com\\\/nraboy\"],\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/pt\\\/author\\\/nic-raboy-2\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using Couchbase Lite in a Java Gluon Application - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/pt\/using-couchbase-lite-in-a-java-gluon-application\/","og_locale":"pt_BR","og_type":"article","og_title":"Using Couchbase Lite in a Java Gluon Application","og_description":"I recently wrote about building desktop applications with Couchbase Lite and JavaFX. As demonstrated Couchbase makes an excellent solution for data storage and sync in a desktop application because of the Java SDK available. However, I realize JavaFX is not for everyone. There is another, similar framework for building desktop applications in Java. It is [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/pt\/using-couchbase-lite-in-a-java-gluon-application\/","og_site_name":"The Couchbase Blog","article_author":"https:\/\/www.facebook.com\/thepolyglotdeveloper","article_published_time":"2016-10-04T15:00:00+00:00","og_image":[{"width":1800,"height":630,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","type":"image\/png"}],"author":"Nic Raboy, Developer Advocate, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@nraboy","twitter_misc":{"Written by":"Nic Raboy, Developer Advocate, Couchbase","Est. reading time":"16 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/"},"author":{"name":"Nic Raboy, Developer Advocate, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1"},"headline":"Using Couchbase Lite in a Java Gluon Application","datePublished":"2016-10-04T15:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/"},"wordCount":1319,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","keywords":["cross platform"],"articleSection":["Couchbase Mobile","Java","Sync Gateway"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/","url":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/","name":"Using Couchbase Lite in a Java Gluon Application - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","datePublished":"2016-10-04T15:00:00+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/using-couchbase-lite-in-a-java-gluon-application\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using Couchbase Lite in a Java Gluon Application"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","width":"1024","height":"1024","caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1","name":"Nic Raboy, Developer Advocate, Couchbase","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g8863514d8bed0cf6080f23db40e00354","url":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","caption":"Nic Raboy, Developer Advocate, Couchbase"},"description":"Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in Java, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Apache Cordova. Nic writes about his development experiences related to making web and mobile development easier to understand.","sameAs":["https:\/\/www.thepolyglotdeveloper.com","https:\/\/www.facebook.com\/thepolyglotdeveloper","https:\/\/x.com\/nraboy"],"url":"https:\/\/www.couchbase.com\/blog\/pt\/author\/nic-raboy-2\/"}]}},"acf":[],"authors":[{"term_id":148,"user_id":63,"is_guest":0,"slug":"nic-raboy-2","display_name":"Nic Raboy, Developer Advocate, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/comments?post=808"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/808\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media\/18"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media?parent=808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/categories?post=808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/tags?post=808"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/ppma_author?post=808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}