///////////////////////////////////////////////////////////////
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
///////////////////////////////////////////////////////////////

:leveloffset: 1

[[samples,Samples Section]]
=  Samples =

== Overview ==

The Zest™ SDK comes with several sample applications. This is a very good place
to look for code examples and recipes.

The samples are available in the +samples/+ directory of the Zest™ SDK.

[[sample-dci, DCI Sample]]
== DCI Sample ==

Sample of how DCI (Data, Context & Interaction) pattern is implemented using
Zest™ core only.

https://github.com/apache/zest-java/tree/develop/samples/dci[Browse Source]

[[sample-dci-cargo,DCI Cargo Sample]]
== DCI Cargo Sample ==

Sample of how DCI (Data, Context & Interaction) pattern is implemented with
Zest™, for Eric Evans DDD sample.

This sample, contributed by Marc Grue, is described in details on his
website: http://marcgrue.com/

https://github.com/apache/zest-java/tree/develop/samples/dci-cargo[Browse Source]

[[sample-forum,Forum Sample]]
== Forum Sample ==

Sample of how to build a web forum using <<library-rest-server>>,
<<extension-es-file>> and <<library-fileconfig>>.

https://github.com/apache/zest-java/tree/develop/samples/forum[Browse Source]

[[sample-car-rental,Car Rental Sample]]
== Car Rental Sample ==

Sample of implementation of a Car Rental application implemented as a Servlet
based Webapp packaged as a WAR.

https://github.com/apache/zest-java/tree/develop/samples/rental[Browse Source]

// [[sample-scala,Scala Sample]]
// == Scala Sample ==
//
// Sample of how to use Scala with Zest™.
//
// https://github.com/apache/zest-java/tree/develop/samples/scala[Browse Source]

[[sample-sql-support,SQL Support Sample]]
== SQL Support Sample ==

NOTE: This sample use PostgreSQL and drop all of its data once run in order to be runnable multiple times.

Sample of how to fully use Zest™ SQL support : <<library-sql>>, <<extension-es-sql>> and <<extension-indexing-sql>>.

https://github.com/apache/zest-java/tree/develop/samples/sql-support[Browse Source]

Here are the steps needed to setup the database using the `psql` utility command:

[source,bash]
----
user@host $ psql postgres
postgres=# CREATE USER jdbc_test_login WITH PASSWORD 'password';
CREATE ROLE
postgres=# CREATE DATABASE jdbc_test_db;
CREATE DATABASE
postgres=# GRANT ALL PRIVILEGES ON DATABASE jdbc_test_db TO jdbc_test_login;
GRANT
postgres=# \q
user@host $  psql -d jdbc_test_db</strong>
postgres=# CREATE EXTENSION ltree;
CREATE EXTENSION
postgres=# \q
user@host $
----

A gradle task `runSample` is defined in this module as a shortcut to run the example. See <<build-system>>.

[[sample-swing,Swing Bindings Sample]]
== Swing Bindings Sample ==

Sample of how to write custom binders.

https://github.com/apache/zest-java/tree/develop/samples/swing[Browse Source]
