blob: 31232eb07bf5bd1006c4f9e257cd96e6700767c8 [file] [log] [blame]
///////////////////////////////////////////////////////////////
* 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 Polygene™ 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 Polygene™ SDK.
[[sample-dci, DCI Sample]]
== DCI Sample ==
Sample of how DCI (Data, Context & Interaction) pattern is implemented using
Polygene™ core only.
https://github.com/apache/polygene-java/tree/develop/samples/dci[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/polygene-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/polygene-java/tree/develop/samples/rental[Browse Source]
// [[sample-scala,Scala Sample]]
// == Scala Sample ==
//
// Sample of how to use Scala with Polygene™.
//
// https://github.com/apache/polygene-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 Polygene™ SQL support : <<library-sql>>, <<extension-es-sqlkv>> and <<extension-indexing-sql>>.
https://github.com/apache/polygene-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 $
----
From the sources you can run the `runSqlSupportSample` Gradle task to run the example.
See <<build-system>> if you need some guidance.
[[sample-swing,Swing Bindings Sample]]
== Swing Bindings Sample ==
Sample of how to write custom binders.
https://github.com/apache/polygene-java/tree/develop/samples/swing[Browse Source]