Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 77CF2200CB7 for ; Tue, 23 May 2017 04:13:49 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 76A5C160BD4; Tue, 23 May 2017 02:13:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2F7DD160BE7 for ; Tue, 23 May 2017 04:13:46 +0200 (CEST) Received: (qmail 68295 invoked by uid 500); 23 May 2017 02:13:45 -0000 Mailing-List: contact commits-help@polygene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@polygene.apache.org Delivered-To: mailing list commits@polygene.apache.org Received: (qmail 67594 invoked by uid 99); 23 May 2017 02:13:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 May 2017 02:13:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5C283E97E9; Tue, 23 May 2017 02:13:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: niclas@apache.org To: commits@polygene.apache.org Date: Tue, 23 May 2017 02:13:55 -0000 Message-Id: <27db9517fd6542a99782984e84085566@git.apache.org> In-Reply-To: <94500831de21422e990706539ae44b22@git.apache.org> References: <94500831de21422e990706539ae44b22@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [12/33] polygene-java git commit: Give the documentation Tools section some love archived-at: Tue, 23 May 2017 02:13:49 -0000 Give the documentation Tools section some love All includes were broken, fixed some typos along the way. Move tools documentation back in tool/${name}/src/docs. For consistency and because the artifact info include was broken on Envisage page. Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/f2969aff Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/f2969aff Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/f2969aff Branch: refs/heads/yeoman-work Commit: f2969affda9d96e18266371189b3ff48c4ba2b02 Parents: e996ce2 Author: Paul Merlin Authored: Sun May 21 16:00:56 2017 +0200 Committer: Paul Merlin Committed: Sun May 21 16:00:56 2017 +0200 ---------------------------------------------------------------------- manual/src/docs/userguide/tools.txt | 9 +- .../src/docs/website/resources/css/polygene.css | 4 + tools/envisage/src/docs/envisage.txt | 55 +++ .../src/docs/yeoman_polygene.txt | 388 +++++++++++++++++++ tools/src/docs/envisage.txt | 55 --- tools/src/docs/yeoman_polygene.txt | 388 ------------------- 6 files changed, 451 insertions(+), 448 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/f2969aff/manual/src/docs/userguide/tools.txt ---------------------------------------------------------------------- diff --git a/manual/src/docs/userguide/tools.txt b/manual/src/docs/userguide/tools.txt index b621669..840115e 100644 --- a/manual/src/docs/userguide/tools.txt +++ b/manual/src/docs/userguide/tools.txt @@ -24,19 +24,18 @@ == Overview == -The Polygene™ SDK comes with usefull development tools. Theses tools can come in +The Polygene™ SDK comes with useful development tools. Theses tools can come in handy when assembled into your <> in development -<>. +<>. The tools are available in the +tools/+ directory of the Polygene™ SDK. :leveloffset: 2 -include:: ../../../tools/src/docs/yeoman_polygene.txt[] +include::../../../../tools/generator-polygene/src/docs/yeoman_polygene.txt[] :leveloffset: 2 -include:: ../../../tools/src/docs/envisage.txt[] -// include:: ../../../tools/envisage/src/docs/envisage.txt[] +include::../../../../tools/envisage/src/docs/envisage.txt[] :leveloffset: 2 http://git-wip-us.apache.org/repos/asf/polygene-java/blob/f2969aff/manual/src/docs/website/resources/css/polygene.css ---------------------------------------------------------------------- diff --git a/manual/src/docs/website/resources/css/polygene.css b/manual/src/docs/website/resources/css/polygene.css index d512429..72f73d2 100644 --- a/manual/src/docs/website/resources/css/polygene.css +++ b/manual/src/docs/website/resources/css/polygene.css @@ -823,3 +823,7 @@ h5 { font-size: 1em; margin-bottom: 0.5em; } font-family: Consolas, Monaco, monospace; background: #DEDEDE; } + +.glossterm { + font-weight: bold; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/f2969aff/tools/envisage/src/docs/envisage.txt ---------------------------------------------------------------------- diff --git a/tools/envisage/src/docs/envisage.txt b/tools/envisage/src/docs/envisage.txt new file mode 100644 index 0000000..4aecf37 --- /dev/null +++ b/tools/envisage/src/docs/envisage.txt @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////////////// + * 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. +/////////////////////////////////////////////////////////////// + +[[tools-envisage,Envisage Tool]] += Envisage = + +Envisage is a Swing based visualization tool for the Polygene™ Application model. +Visualizations can be printed to PDFs. + +== Usage == + +Envisage can be easily used directly and prior your Application activation: + +[snippet,java] +---- +source=tools/envisage/src/test/java/org/apache/polygene/envisage/school/EnvisageSchoolSample.java +tag=envisage +---- + +As you can see, Envisage operates on the ApplicationModel, this means that you +can easily embed it in your own Applications too. + +From the sources you can run the `runEnvisageSample` or `runEnvisageSchoolSample` Gradle tasks +to run interactive examples. See <> if you need some guidance. + +== Screenshots == + +image:tools-envisage-structure.png[width="800px"] + +image:tools-envisage-type.png[width="800px"] + +image:tools-envisage-stacked.png[width="800px"] + +image:tools-envisage-stacked-collapsed.png[width="800px"] + +== Embedd in your Application == + +include::../../build/docs/buildinfo/artifact.txt[] + http://git-wip-us.apache.org/repos/asf/polygene-java/blob/f2969aff/tools/generator-polygene/src/docs/yeoman_polygene.txt ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/src/docs/yeoman_polygene.txt b/tools/generator-polygene/src/docs/yeoman_polygene.txt new file mode 100644 index 0000000..cff7882 --- /dev/null +++ b/tools/generator-polygene/src/docs/yeoman_polygene.txt @@ -0,0 +1,388 @@ +/////////////////////////////////////////////////////////////// + * 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. +/////////////////////////////////////////////////////////////// + +[[tools-shell,Command Line Shell]] += Polygene Generator = +Apache Polygene comes with a Yeoman code generator, to quickly set up a development +environment for Polygene applications. + +[source,shell] +---- +mkdir projectdirname +cd projectdirname +yo polygene +---- + +It will ask a lot of questions. For choice questions, you operate up and down, and with multi-choice, you +select with space bar. + +== First Trial == + +=== Project Name === +It starts with the Project name. This will be the project name in Gradle and any gradle driven naming of the +project such as in IDEs. It defaults to current directory with initial uppercase letter. + +[source,shell] +---- +? Your project name +---- + +=== Java Package Name === +This is the root of the package names in the multi-module, multi-package project. + +[source,shell] +---- +? Java package name +---- + +=== Application Type === + +The Application Type that you want to create. + +NOTE: Command Line is currently not implemented correctly, and the Rest API is still not complete. + +[source,shell] +---- +? what type of application do you want to create? + Command Line +❯ Rest API +---- + +=== Entity Store === +Polygene has built-in persistence, and that is backed by entity store plugins. There are currently a fair +number of implementations to choose from. Not that "memory" is not persistent, but looses the content on shutdown. + +[source,shell] +---- +? Which entity store do you want to use? + Cassandra + File + DerbySQL + Geode + H2SQL + Hazelcast + JClouds + Jdbm + LevelDB +> Memory + MongoDB + MySQL + Preferences + Redis + Riak + PostgreSQL + SQLite +---- + +=== Indexing/Query system === +Select of a pluggable Indexing and Query subsystem. + +In Polygene, the indexing/query system is separated from store and retrieve. This allows us to optimize direct +fetches for navigating object graphs. In practical Polygene applications, we find that querying is not nearly as +common as in, say, JPA applications. The query layout in the underlying indexing system is also very different +from the document-oriented approach of most entity stores. + +NOTE: Not all indexing subsystems support all of the specified Indexing/Query SPI. + +[source,shell] +---- +? Which indexing system do you want to use? +> Rdf + ElasticSearch + Solr + SQL +---- + +=== Caching System === +Some of the entity stores rely on a Polygene level caching SPI. This caching subsystem is pluggable and +will be used by any of the entity stores that uses the internal MapEntityStore SPI + +[source,shell] +---- +? Which caching system do you want to use? +> None + Memcache + EhCache +---- + +=== Serialization system === +Serialization is a key concept in business applications, and in Polygene that is a pluggable subsystem. + +? Which serialization system do you want to use? + +[source,shell] +---- +> JavaxJson + JavaxXml + MessagePack +---- + +=== Metrics System === +Metrics is the SPI for measuring the performance and health of an Polygene application. Currently only +one implementation is available. + +? Which metrics capturing system do you want to use? + +[source,shell] +---- +> None + Codahale +---- + +=== Other Features === + +JMX feature installs the MBean server and registers all Services with it, in the application structure defined. + +Mixin Scripting is allowing Mixin methods to be implemented in other languages parallel to Java. + +Security installs Apache Shiro and binds Users, Groups and Roles to entity store. + +[source,shell] +---- +? Other features? + ◯ jmx + ◯ mixin scripting + ◯ security +---- + + +=== Example === + +[source,shell] +---- +~/dev/sensetif/sink$ yo polygene +? Your project name Sink +? Java package name com.sensetif.sink +? what type of application do you want to create? Rest API +? Which entity store do you want to use? Cassandra +? Which indexing system do you want to use? Rdf +? Which caching system do you want to use? None +? Which serialization system do you want to use? JavaxJson +? Which metrics capturing system do you want to use? Codahale +? Other features? jmx, security +app name Sink +Entity Stores: Cassandra +Indexing: Rdf +Caching: None +Serialization: JavaxJson +Features: [ 'jmx', 'security' ] + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/config/ConfigurationLayer.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/InfrastructureLayer.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/DomainLayer.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/connectivity/ConnectivityLayer.java + create app/src/main/webapp/WEB-INF/web.xml + create app/build.gradle + create bootstrap/build.gradle + create model/build.gradle + create rest/build.gradle + create build.gradle + create settings.gradle + create gradlew + create gradlew.bat + create gradle/wrapper/gradle-wrapper.jar + create gradle/wrapper/gradle-wrapper.properties + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/config/ConfigModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/FileConfigurationModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/RdfIndexingModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/CodahaleMetricsModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/JavaxJsonSerializationModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/CassandraStorageModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/CrudModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/JmxModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/SecurityModule.java + create model/src/main/java/com/sensetif/sink/model/security/CryptoConfiguration.java + create model/src/main/java/com/sensetif/sink/model/security/CryptoException.java + create model/src/main/java/com/sensetif/sink/model/security/CryptoService.java + create model/src/main/java/com/sensetif/sink/model/security/EncryptedStringPropertyConcern.java + create model/src/main/java/com/sensetif/sink/model/security/Group.java + create model/src/main/java/com/sensetif/sink/model/security/RealmService.java + create model/src/main/java/com/sensetif/sink/model/security/SecurityRepository.java + create model/src/main/java/com/sensetif/sink/model/security/User.java + create model/src/main/java/com/sensetif/sink/model/security/UserFactory.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/connectivity/RestApiModule.java + create rest/src/main/java/com/sensetif/sink/rest/security/DefaultEnroler.java + create rest/src/main/java/com/sensetif/sink/rest/security/DefaultVerifier.java +---- + +== Command Line Options == + +[source,shell] +---- +--import= Imports the model from a JSON file and creates a project descibed therein. +--export= Exports the generated model to a JSON file in the same format as the import model. +--noPrompt If this option is not provided for --import-model, the user can still + input answers, which will override the values in the imported model +---- + +=== Example === + +If we run the following, + +[source,shell] +---- +$ yo polygene --import=../model.json --noPrompt +---- + +where the content of the +../model.json+ is as follows, + +[source] +---- +{ + "name": "Sink", + "packageName": "com.sensetif.sink", + "applicationtype": "Rest API", + "features": [ + "security" + ], + "entitystore": "MongoDB", + "indexing": "SQL", + "caching": "Memcache", + "serialization": "JavaxJson", + "metrics": "Codahale", + "modules": { + "user": { + "cruds": [ + { "name": "Users" }, + {"name": "Roles"}, + {"name": "User"}, + {"name": "Role"}, + {"name": "Permission"}, + {"name": "Group"}, + {"name": "Groups"} + ], + "services": [ + { + "name": "AuthService", + "visibility": "application", + "configuration" : [ + { "name": "backend", "type": "java.lang.String" }, + { "name": "connectString", "type": "java.lang.String" } + ] + } + ] + }, + "organization": { + "cruds": [ + {"name": "Organizations"}, + { + "name": "Organization", + "properties": [ + { "name": "name", "type": "java.lang.String" }, + { "name": "created", "type": "java.time.Instant" } + ] + }, + { "name": "Project" } + ], + "entities": [ + { "name": "Invoice" } + ], + "values": [ + { + "name": "CreditLimit", + "properties" : [ + { "name" : "amount", "type" : "java.math.BigDecimal" }, + { "name" : "currency", "type" : "java.lang.String" } + ] + } + ], + "transients": [ + { "name": "OrderConfirmation" } + ], + "objects": [ + { "name": "PaypalNotification" } + ] + }, + "sensor": { + "cruds": [ + { "name": "SensorData" } + ], + "entities": [ + { "name": "Sensor" }, + { "name": "PollSchedule" } + ] + } + } +} +---------------- + +we will create a complete project, like this + +[source,shell] +---- + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/config/ConfigurationLayer.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/InfrastructureLayer.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/DomainLayer.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/connectivity/ConnectivityLayer.java + create app/src/main/webapp/WEB-INF/web.xml + create app/build.gradle + create bootstrap/build.gradle + create model/build.gradle + create rest/build.gradle + create build.gradle + create settings.gradle + create gradlew + create gradlew.bat + create gradle/wrapper/gradle-wrapper.jar + create gradle/wrapper/gradle-wrapper.properties + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/config/ConfigModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/MemcacheCachingModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/FileConfigurationModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/SQLIndexingModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/CodahaleMetricsModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/JavaxJsonSerializationModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/CassandraStorageModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/CrudModule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/UserModule.java + create model/src/main/java/com/sensetif/sink/model/user/Users.java + create model/src/main/java/com/sensetif/sink/model/user/Roles.java + create model/src/main/java/com/sensetif/sink/model/user/User.java + create model/src/main/java/com/sensetif/sink/model/user/Role.java + create model/src/main/java/com/sensetif/sink/model/user/Permission.java + create model/src/main/java/com/sensetif/sink/model/user/Group.java + create model/src/main/java/com/sensetif/sink/model/user/Groups.java + create model/src/main/java/com/sensetif/sink/model/user/AuthService.java + create model/src/main/java/com/sensetif/sink/model/user/AuthConfiguration.java + create model/src/main/resources/com/sensetif/sink/model/user/AuthConfiguration.yaml + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/OrganizationModule.java + create model/src/main/java/com/sensetif/sink/model/organization/Organizations.java + create model/src/main/java/com/sensetif/sink/model/organization/Organization.java + create model/src/main/java/com/sensetif/sink/model/organization/Project.java + create model/src/main/java/com/sensetif/sink/model/organization/Invoice.java + create model/src/main/java/com/sensetif/sink/model/organization/CreditLimit.java + create model/src/main/java/com/sensetif/sink/model/organization/OrderConfirmation.java + create model/src/main/java/com/sensetif/sink/model/organization/PaypalNotification.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/SensorModule.java + create model/src/main/java/com/sensetif/sink/model/sensor/SensorData.java + create model/src/main/java/com/sensetif/sink/model/sensor/Sensor.java + create model/src/main/java/com/sensetif/sink/model/sensor/PollSchedule.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/SecurityModule.java + create model/src/main/java/com/sensetif/sink/model/security/CryptoConfiguration.java + create model/src/main/java/com/sensetif/sink/model/security/CryptoException.java + create model/src/main/java/com/sensetif/sink/model/security/CryptoService.java + create model/src/main/java/com/sensetif/sink/model/security/EncryptedStringPropertyConcern.java + create model/src/main/java/com/sensetif/sink/model/security/Group.java + create model/src/main/java/com/sensetif/sink/model/security/RealmService.java + create model/src/main/java/com/sensetif/sink/model/security/SecurityRepository.java + create model/src/main/java/com/sensetif/sink/model/security/User.java + create model/src/main/java/com/sensetif/sink/model/security/UserFactory.java + create bootstrap/src/main/java/com/sensetif/sink/bootstrap/connectivity/RestApiModule.java + create rest/src/main/java/com/sensetif/sink/rest/security/DefaultEnroler.java + create rest/src/main/java/com/sensetif/sink/rest/security/DefaultVerifier.java +---- + http://git-wip-us.apache.org/repos/asf/polygene-java/blob/f2969aff/tools/src/docs/envisage.txt ---------------------------------------------------------------------- diff --git a/tools/src/docs/envisage.txt b/tools/src/docs/envisage.txt deleted file mode 100644 index 4aecf37..0000000 --- a/tools/src/docs/envisage.txt +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////// - * 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. -/////////////////////////////////////////////////////////////// - -[[tools-envisage,Envisage Tool]] -= Envisage = - -Envisage is a Swing based visualization tool for the Polygene™ Application model. -Visualizations can be printed to PDFs. - -== Usage == - -Envisage can be easily used directly and prior your Application activation: - -[snippet,java] ----- -source=tools/envisage/src/test/java/org/apache/polygene/envisage/school/EnvisageSchoolSample.java -tag=envisage ----- - -As you can see, Envisage operates on the ApplicationModel, this means that you -can easily embed it in your own Applications too. - -From the sources you can run the `runEnvisageSample` or `runEnvisageSchoolSample` Gradle tasks -to run interactive examples. See <> if you need some guidance. - -== Screenshots == - -image:tools-envisage-structure.png[width="800px"] - -image:tools-envisage-type.png[width="800px"] - -image:tools-envisage-stacked.png[width="800px"] - -image:tools-envisage-stacked-collapsed.png[width="800px"] - -== Embedd in your Application == - -include::../../build/docs/buildinfo/artifact.txt[] - http://git-wip-us.apache.org/repos/asf/polygene-java/blob/f2969aff/tools/src/docs/yeoman_polygene.txt ---------------------------------------------------------------------- diff --git a/tools/src/docs/yeoman_polygene.txt b/tools/src/docs/yeoman_polygene.txt deleted file mode 100644 index 0a9e779..0000000 --- a/tools/src/docs/yeoman_polygene.txt +++ /dev/null @@ -1,388 +0,0 @@ -/////////////////////////////////////////////////////////////// - * 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. -/////////////////////////////////////////////////////////////// - -[[tools-shell,Command Line Shell]] -= Polygene Generator = -Apache Polygene comes with a Yeoman code generator, to quickly set up a development -environment for Polygene applications. - -[source,shell] ----- -mkdir projectdirname -cd projectdirname -yo polygene ----- - -It will ask a lot of questions. For choice questions, you operate up and down, and with multi-choice, you -select with space bar. - -== First Trial == - -=== Project Name === -It starts with the Project name. This will be the project name in Gradle and any gradle driven naming of the -project such as in IDEs. It defaults to current directory with initial uppercase letter. - -[source,shell] ----- -? Your project name ----- - -=== Java Package Name === -This is the root of the package names in the multi-module, multi-package project. - -[source,shell] ----- -? Java package name ----- - -=== Application Type === - -The Application Type that you want to create. - -NOTE: Command Line is currently not implemented correctly, and the Rest API is still not complete. - -[source,shell] ----- -? what type of application do you want to create? - Command Line -❯ Rest API ----- - -=== Entity Store === -Polygene has built-in persistence, and that is backed by entity store plugins. There are currently a fair -number of implementations to choose from. Not that "memory" is not persistent, but looses the content on shutdown. - -[source,shell] ----- -? Which entity store do you want to use? - Cassandra - File - DerbySQL - Geode - H2SQL - Hazelcast - JClouds - Jdbm - LevelDB -> Memory - MongoDB - MySQL - Preferences - Redis - Riak - PostgreSQL - SQLite ----- - -=== Indexin/Query system === -Select of a pluggable Indexing and Query subsystem. - -In Polygene, the indexing/query system is separated from store and retrieve. This allows us to optimize direct -fetches for navigating object graphs. In practical Polygene applications, we find that querying is not nearly as -common as in, say, JPA applications. The query layout in the underlying indexing system is also very different -from the document-oriented approach of most entity stores. - -NOTE: Not all indexing subsystems support all of the specified Indexing/Query SPI. - -[source,shell] ----- -? Which indexing system do you want to use? -> Rdf - ElasticSearch - Solr - SQL ----- - -=== Caching System === -Some of the entity stores rely on a Polygene level caching SPI. This caching subsystem is pluggable and -will be used by any of the entity stores that uses the internal MapEntityStore SPI - -[source,shell] ----- -? Which caching system do you want to use? -> None - Memcache - EhCache ----- - -=== Serialization system === -Serialization is a key concept in business applications, and in Polygene that is a pluggable subsystem. - -? Which serialization system do you want to use? - -[source,shell] ----- -> JavaxJson - JavaxXml - MessagePack ----- - -=== Metrics System === -Metrics is the SPI for measuring the performance and health of an Polygene application. Currently only -one implementation is available. - -? Which metrics capturing system do you want to use? - -[source,shell] ----- -> None - Codahale ----- - -=== Other Features === - -JMX feature installs the MBean server and registers all Services with it, in the application structure defined. - -Mixin Scripting is allowing Mixin methods to be implemented in other languages parallel to Java. - -Security installs Apache Shiro and binds Users, Groups and Roles to entity store. - -[source,shell] ----- -? Other features? - ◯ jmx - ◯ mixin scripting - ◯ security ----- - - -=== Example === - -[source,shell] ----- -~/dev/sensetif/sink$ yo polygene -? Your project name Sink -? Java package name com.sensetif.sink -? what type of application do you want to create? Rest API -? Which entity store do you want to use? Cassandra -? Which indexing system do you want to use? Rdf -? Which caching system do you want to use? None -? Which serialization system do you want to use? JavaxJson -? Which metrics capturing system do you want to use? Codahale -? Other features? jmx, security -app name Sink -Entity Stores: Cassandra -Indexing: Rdf -Caching: None -Serialization: JavaxJson -Features: [ 'jmx', 'security' ] - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/config/ConfigurationLayer.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/InfrastructureLayer.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/DomainLayer.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/connectivity/ConnectivityLayer.java - create app/src/main/webapp/WEB-INF/web.xml - create app/build.gradle - create bootstrap/build.gradle - create model/build.gradle - create rest/build.gradle - create build.gradle - create settings.gradle - create gradlew - create gradlew.bat - create gradle/wrapper/gradle-wrapper.jar - create gradle/wrapper/gradle-wrapper.properties - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/config/ConfigModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/FileConfigurationModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/RdfIndexingModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/CodahaleMetricsModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/JavaxJsonSerializationModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/CassandraStorageModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/CrudModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/JmxModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/SecurityModule.java - create model/src/main/java/com/sensetif/sink/model/security/CryptoConfiguration.java - create model/src/main/java/com/sensetif/sink/model/security/CryptoException.java - create model/src/main/java/com/sensetif/sink/model/security/CryptoService.java - create model/src/main/java/com/sensetif/sink/model/security/EncryptedStringPropertyConcern.java - create model/src/main/java/com/sensetif/sink/model/security/Group.java - create model/src/main/java/com/sensetif/sink/model/security/RealmService.java - create model/src/main/java/com/sensetif/sink/model/security/SecurityRepository.java - create model/src/main/java/com/sensetif/sink/model/security/User.java - create model/src/main/java/com/sensetif/sink/model/security/UserFactory.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/connectivity/RestApiModule.java - create rest/src/main/java/com/sensetif/sink/rest/security/DefaultEnroler.java - create rest/src/main/java/com/sensetif/sink/rest/security/DefaultVerifier.java ----- - -== Command Line Options == - -[source,shell] ----- ---import= Imports the model from a JSON file and creates a project descibed therein. ---export= Exports the generated model to a JSON file in the same format as the import model. ---noPrompt If this option is not provided for --import-model, the user can still - input answers, which will override the values in the imported model ----- - -=== Example === - -If we run the following, - -[source,shell] ----- -$ yo polygene --import=../model.json --noPrompt ----- - -where the content of the +../model.json+ is as follows, - -[source] ----- -{ - "name": "Sink", - "packageName": "com.sensetif.sink", - "applicationtype": "Rest API", - "features": [ - "security" - ], - "entitystore": "MongoDB", - "indexing": "SQL", - "caching": "Memcache", - "serialization": "JavaxJson", - "metrics": "Codahale", - "modules": { - "user": { - "cruds": [ - { "name": "Users" }, - {"name": "Roles"}, - {"name": "User"}, - {"name": "Role"}, - {"name": "Permission"}, - {"name": "Group"}, - {"name": "Groups"} - ], - "services": [ - { - "name": "AuthService", - "visibility": "application", - "configuration" : [ - { "name": "backend", "type": "java.lang.String" }, - { "name": "connectString", "type": "java.lang.String" } - ] - } - ] - }, - "organization": { - "cruds": [ - {"name": "Organizations"}, - { - "name": "Organization", - "properties": [ - { "name": "name", "type": "java.lang.String" }, - { "name": "created", "type": "java.time.Instant" } - ] - }, - { "name": "Project" } - ], - "entities": [ - { "name": "Invoice" } - ], - "values": [ - { - "name": "CreditLimit", - "properties" : [ - { "name" : "amount", "type" : "java.math.BigDecimal" }, - { "name" : "currency", "type" : "java.lang.String" } - ] - } - ], - "transients": [ - { "name": "OrderConfirmation" } - ], - "objects": [ - { "name": "PaypalNotification" } - ] - }, - "sensor": { - "cruds": [ - { "name": "SensorData" } - ], - "entities": [ - { "name": "Sensor" }, - { "name": "PollSchedule" } - ] - } - } -} ----------------- - -we will create a complete project, like this - -[source,shell] ----- - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/config/ConfigurationLayer.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/InfrastructureLayer.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/DomainLayer.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/connectivity/ConnectivityLayer.java - create app/src/main/webapp/WEB-INF/web.xml - create app/build.gradle - create bootstrap/build.gradle - create model/build.gradle - create rest/build.gradle - create build.gradle - create settings.gradle - create gradlew - create gradlew.bat - create gradle/wrapper/gradle-wrapper.jar - create gradle/wrapper/gradle-wrapper.properties - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/config/ConfigModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/MemcacheCachingModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/FileConfigurationModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/SQLIndexingModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/CodahaleMetricsModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/JavaxJsonSerializationModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/infrastructure/CassandraStorageModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/CrudModule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/UserModule.java - create model/src/main/java/com/sensetif/sink/model/user/Users.java - create model/src/main/java/com/sensetif/sink/model/user/Roles.java - create model/src/main/java/com/sensetif/sink/model/user/User.java - create model/src/main/java/com/sensetif/sink/model/user/Role.java - create model/src/main/java/com/sensetif/sink/model/user/Permission.java - create model/src/main/java/com/sensetif/sink/model/user/Group.java - create model/src/main/java/com/sensetif/sink/model/user/Groups.java - create model/src/main/java/com/sensetif/sink/model/user/AuthService.java - create model/src/main/java/com/sensetif/sink/model/user/AuthConfiguration.java - create model/src/main/resources/com/sensetif/sink/model/user/AuthConfiguration.yaml - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/OrganizationModule.java - create model/src/main/java/com/sensetif/sink/model/organization/Organizations.java - create model/src/main/java/com/sensetif/sink/model/organization/Organization.java - create model/src/main/java/com/sensetif/sink/model/organization/Project.java - create model/src/main/java/com/sensetif/sink/model/organization/Invoice.java - create model/src/main/java/com/sensetif/sink/model/organization/CreditLimit.java - create model/src/main/java/com/sensetif/sink/model/organization/OrderConfirmation.java - create model/src/main/java/com/sensetif/sink/model/organization/PaypalNotification.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/SensorModule.java - create model/src/main/java/com/sensetif/sink/model/sensor/SensorData.java - create model/src/main/java/com/sensetif/sink/model/sensor/Sensor.java - create model/src/main/java/com/sensetif/sink/model/sensor/PollSchedule.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/domain/SecurityModule.java - create model/src/main/java/com/sensetif/sink/model/security/CryptoConfiguration.java - create model/src/main/java/com/sensetif/sink/model/security/CryptoException.java - create model/src/main/java/com/sensetif/sink/model/security/CryptoService.java - create model/src/main/java/com/sensetif/sink/model/security/EncryptedStringPropertyConcern.java - create model/src/main/java/com/sensetif/sink/model/security/Group.java - create model/src/main/java/com/sensetif/sink/model/security/RealmService.java - create model/src/main/java/com/sensetif/sink/model/security/SecurityRepository.java - create model/src/main/java/com/sensetif/sink/model/security/User.java - create model/src/main/java/com/sensetif/sink/model/security/UserFactory.java - create bootstrap/src/main/java/com/sensetif/sink/bootstrap/connectivity/RestApiModule.java - create rest/src/main/java/com/sensetif/sink/rest/security/DefaultEnroler.java - create rest/src/main/java/com/sensetif/sink/rest/security/DefaultVerifier.java ----- -