polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [13/15] polygene-java git commit: Yeoman generator improvements
Date Sat, 18 Feb 2017 00:43:39 GMT
Yeoman generator improvements


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/75b3668c
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/75b3668c
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/75b3668c

Branch: refs/heads/develop
Commit: 75b3668c43a3ae28221f6b06b7e16b6907d24f51
Parents: ea639e8
Author: niclas <niclas@spicter.com>
Authored: Tue Feb 14 12:47:34 2017 +0800
Committer: niclas <niclas@spicter.com>
Committed: Tue Feb 14 12:47:34 2017 +0800

----------------------------------------------------------------------
 .../helpers/MapEntityStoreMixin.java            |   2 +-
 .../spi/value/ValueDeserializerAdapter.java     |  13 +--
 tools/generator-polygene/app/index.js           |   9 +-
 .../app/templates/buildtool/gradle-app.tmpl     |   2 +-
 .../templates/buildtool/gradle-bootstrap.tmpl   |   4 +-
 .../app/templates/buildtool/gradle-rest.tmpl    |   2 +-
 .../buildtool/gradle-wrapper.properties_        |   2 +-
 tools/shell/src/docs/shell.txt                  | 101 -------------------
 tools/src/docs/yeoman_polygene.txt              |  99 ++++++++++++++++++
 9 files changed, 117 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/75b3668c/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/MapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/MapEntityStoreMixin.java
b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/MapEntityStoreMixin.java
index 40cfa76..dc4db58 100644
--- a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/MapEntityStoreMixin.java
+++ b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/MapEntityStoreMixin.java
@@ -405,7 +405,7 @@ public class MapEntityStoreMixin
                 catch( JSONException e )
                 {
                     // Value not found, default it
-                    Object initialValue = propertyDescriptor.initialValue( module );
+                    Object initialValue = propertyDescriptor.resolveInitialValue(module);
                     properties.put( propertyDescriptor.qualifiedName(), initialValue );
                     status[ 0 ] = EntityStatus.UPDATED;
                 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/75b3668c/core/spi/src/main/java/org/apache/polygene/spi/value/ValueDeserializerAdapter.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/polygene/spi/value/ValueDeserializerAdapter.java
b/core/spi/src/main/java/org/apache/polygene/spi/value/ValueDeserializerAdapter.java
index cac2270..c586498 100644
--- a/core/spi/src/main/java/org/apache/polygene/spi/value/ValueDeserializerAdapter.java
+++ b/core/spi/src/main/java/org/apache/polygene/spi/value/ValueDeserializerAdapter.java
@@ -48,6 +48,7 @@ import java.util.stream.StreamSupport;
 import org.apache.polygene.api.entity.EntityReference;
 import org.apache.polygene.api.identity.Identity;
 import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.structure.ModuleDescriptor;
 import org.apache.polygene.api.type.CollectionType;
 import org.apache.polygene.api.type.EnumType;
@@ -462,20 +463,20 @@ public abstract class ValueDeserializerAdapter<InputType, InputNodeType>
         final Map<String, Object> stateMap = new HashMap<>();
 
         // Properties
-        valueCompositeType.properties().forEach( property -> {
+        valueCompositeType.properties().forEach( propertyDescriptor -> {
             String propertyName = null;
             Object value;
             try
             {
-                propertyName = property.qualifiedName().name();
+                propertyName = propertyDescriptor.qualifiedName().name();
                 if( objectHasField( module, inputNode, propertyName ) )
                 {
                     value = getObjectFieldValue(
                         module,
                         inputNode,
                         propertyName,
-                        buildDeserializeInputNodeFunction( module, property.valueType() )
);
-                    if( property.isImmutable() )
+                        buildDeserializeInputNodeFunction( module, propertyDescriptor.valueType()
) );
+                    if( propertyDescriptor.isImmutable() )
                     {
                         if( value instanceof Set )
                         {
@@ -494,12 +495,12 @@ public abstract class ValueDeserializerAdapter<InputType, InputNodeType>
                 else
                 {
                     // Serialized object does not contain the field, try to default it
-                    value = property.initialValue( module );
+                    value = propertyDescriptor.resolveInitialValue(module);
                 }
             }
             catch( Exception e )
             {
-                throw new ValueSerializationException( "Unable to deserialize property "
+ property, e );
+                throw new ValueSerializationException( "Unable to deserialize property "
+ propertyDescriptor, e );
             }
             stateMap.put( propertyName, value );
         } );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/75b3668c/tools/generator-polygene/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/index.js b/tools/generator-polygene/app/index.js
index 4d57562..cddb34a 100644
--- a/tools/generator-polygene/app/index.js
+++ b/tools/generator-polygene/app/index.js
@@ -61,22 +61,23 @@ module.exports = generators.Base.extend(
                         type: 'list',
                         name: 'entitystore',
                         choices: [
+                            'Cassandra',
                             'File',
+                            'DerbySQL',
                             'Geode',
+                            'H2SQL',
                             'Hazelcast',
                             'JClouds',
                             'Jdbm',
                             'LevelDB',
                             'Memory',
                             'MongoDB',
+                            'MySQL',
                             'Preferences',
                             'Redis',
                             'Riak',
-                            'MySQL',
                             'PostgresSQL',
-                            'SQLite',
-                            'H2SQL',
-                            'DerbySQL'
+                            'SQLite'
                         ],
                         message: 'Which entity store do you want to use?'
                     },

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/75b3668c/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
index f307e8b..880a5e5 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
@@ -30,7 +30,7 @@ dependencies {
 
   compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
   compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.servlet:$polygeneVersion"
+  compile "org.apache.polygene.libraries:org.apache.polygene.library.servlet:$polygeneVersion"
 
   compile "javax.servlet:servlet-api:2.5"
   compile "org.restlet.jee:org.restlet:2.3.4"

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/75b3668c/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
index 3261944..d13cb96 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
@@ -25,9 +25,9 @@ dependencies {
   compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
 
 
-  compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$polygeneVersion"
+  compile "org.apache.polygene.libraries:org.apache.polygene.library.fileconfig:$polygeneVersion"
 <% if( hasFeature( 'rest api' ) ) { %>
-  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
+  compile "org.apache.polygene.libraries:org.apache.polygene.library.restlet:$polygeneVersion"
 <% } %>
   compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-<%=
polygene.entitystore.toLowerCase() %>:$polygeneVersion"
   compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-<%= polygene.indexing.toLowerCase()
%>:$polygeneVersion"

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/75b3668c/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl
index 5c389c2..82afa09 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl
@@ -22,6 +22,6 @@ dependencies {
   compile project( ":model" )
 
   compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
+  compile "org.apache.polygene.libraries:org.apache.polygene.library.restlet:$polygeneVersion"
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/75b3668c/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.properties_
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.properties_ b/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.properties_
index 731cb78..c90307d 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.properties_
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.properties_
@@ -21,4 +21,4 @@ distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/75b3668c/tools/shell/src/docs/shell.txt
----------------------------------------------------------------------
diff --git a/tools/shell/src/docs/shell.txt b/tools/shell/src/docs/shell.txt
deleted file mode 100644
index 9ebc47c..0000000
--- a/tools/shell/src/docs/shell.txt
+++ /dev/null
@@ -1,101 +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 Shell =
-If you have installed the Polygene SDK, there is a +bin/polygene+ command line script,
-which has sub-functions in it. This list of commands will slowly grow
-for various purposes of doing software development with Apache Polygene.
-
-The current list of commands are;
-
-    * <<tools-shell-create-project>>
-
-[[tools-shell-create-project,Create Project Script]]
-== Create Project ==
-
-This command creates a brand new project, in current directory, with a name
-provided. There are more than one template of the type of project that one
-might want to create. Full list of types to follow below. The command
-takes at least 3 additional arguments;
-
----------------------------
-polygene create-project type name package
----------------------------
-
-A directory called _name_ will be created in the current directory, and all
-the necessary structure for a Polygene project using Gradle will be created.
-
-The exact layout of the project depends on the _type_ argument and currently the
-following types exists;
-
-    * <<tools-shell-create-project-null>> - Creates the build system and directory
structure.
-    * <<tools-shell-create-project-singleton>> - Creates a small application
around the +SingletonAssembler+
-    * <<tools-shell-create-project-default>> - Creates a 4 layer, Configuration,
Infrastructure, Domain and Connectivity, command line application.
-    * <<tools-shell-create-project-restapp>> - Creates the same 4 layer application
as _default_, but also sets it up as a Restful application, ready to deploy on a web application
container.
-
-The _package_ defines the root package name to be used, e.g. +org.apache.polygene.coolapp+.
The +create-project+ program
-will create additional packages under this, according to its template.
-
-[[tools-shell-create-project-null,Create Null Project]]
-=== Create Null Project Template ===
-This templates only creates the build system for a single module application. Neither Java
files nor other resources
-are created, and the developer has to set everything up from scratch.
-
-[[tools-shell-create-project-singleton,Create Singleton Project]]
-=== Create Singleton Project Template ===
-This template creates a so called Singleton application. That is an application with a single
Layer and a single
-Module in that layer. In Polygene, all applications must have at least one Layer and one
Module.
-
-This is useful for really small applications or demos, not expected to become large in the
future. It is
-also currently required that the infrastructure is configuration free, otherwise it is not
possible to set up.
-
-The template will configure the File EntityStore and RDF Indexing subsystems, hardcoded to
the +polygene/store+ and
-+polygene/index+ respectively in the current directory where the application is started.
This may not be suitable, in
-which case you should look at the <<tools-shell-create-project-default>> template.
-
-[[tools-shell-create-project-default,Create Default Project]]
-=== Create Default Project Template ===
-This template sets up a 4 layer, Configuration, Infrastructure, Domain, Connectivity, command
line application.
-
-The template includes a small sample domain model, +Order+, +OrderItem+, +Customer+, but
there is no functionality
-added to it.
-
-A +SecurityRepository+ is also created, with a simple hardcoded implementation (+HardCodedSecurityRepositoryMixin+).
-
-[[tools-shell-create-project-restapp,Create Rest Application Project]]
-=== Create Rest Application Project Template ===
-This template sets up a 4 layer, Configuration, Infrastructure, Domain, Connectivity, restful
application. This
-application will use the <<library-restlet>> to create a full web application,
ready to deploy on a servlet
-container, such as Tomcat or Jetty.
-
-The template includes a small sample domain model, +Order+, +OrderItem+, +Customer+, and
have the CRUD operations
-for these already wired up to the restful +EndPoint+. Full HATEOAS is provided, so clients
don't need to construct
-URLs, but simply follow links and use forms.
-
-The template also creates a simple SecurityRepository and attaches the mechanisms in the
underlying Restlet
-implementation to do Authentication and Authorization (see SimpleEnroler and SimpleVerifier).
There are two
-hardcoded users with two hardcoded roles.
-
------------
-# name     password     roles
-  user       123        user
-  admin     secret      admin
------------
-

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/75b3668c/tools/src/docs/yeoman_polygene.txt
----------------------------------------------------------------------
diff --git a/tools/src/docs/yeoman_polygene.txt b/tools/src/docs/yeoman_polygene.txt
new file mode 100644
index 0000000..38a7e0f
--- /dev/null
+++ b/tools/src/docs/yeoman_polygene.txt
@@ -0,0 +1,99 @@
+///////////////////////////////////////////////////////////////
+ * 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.
+
+The current list of commands are;
+
+    * <<tools-yeoman-create-project>>
+
+[[tools-yeoman-create-project,Create Project Script]]
+== Create Project ==
+
+This command creates a brand new project, in current directory. The generator
+will ask a lot of questions. If you are new to Polygene and only want to try
+it out, it is safe to hit ENTER on all questions.
+
+---------------------------
+yo polygene create-project
+---------------------------
+
+A directory called _name_ will be created in the current directory, and all
+the necessary structure for a Polygene project using Gradle will be created.
+
+The exact layout of the project depends on the _type_ argument and currently the
+following types exists;
+
+    * <<tools-shell-create-project-null>> - Creates the build system and directory
structure.
+    * <<tools-shell-create-project-singleton>> - Creates a small application
around the +SingletonAssembler+
+    * <<tools-shell-create-project-default>> - Creates a 4 layer, Configuration,
Infrastructure, Domain and Connectivity, command line application.
+    * <<tools-shell-create-project-restapp>> - Creates the same 4 layer application
as _default_, but also sets it up as a Restful application, ready to deploy on a web application
container.
+
+The _package_ defines the root package name to be used, e.g. +org.apache.polygene.coolapp+.
The +create-project+ program
+will create additional packages under this, according to its template.
+
+[[tools-shell-create-project-null,Create Null Project]]
+=== Create Null Project Template ===
+This templates only creates the build system for a single module application. Neither Java
files nor other resources
+are created, and the developer has to set everything up from scratch.
+
+[[tools-shell-create-project-singleton,Create Singleton Project]]
+=== Create Singleton Project Template ===
+This template creates a so called Singleton application. That is an application with a single
Layer and a single
+Module in that layer. In Polygene, all applications must have at least one Layer and one
Module.
+
+This is useful for really small applications or demos, not expected to become large in the
future. It is
+also currently required that the infrastructure is configuration free, otherwise it is not
possible to set up.
+
+The template will configure the File EntityStore and RDF Indexing subsystems, hardcoded to
the +polygene/store+ and
++polygene/index+ respectively in the current directory where the application is started.
This may not be suitable, in
+which case you should look at the <<tools-shell-create-project-default>> template.
+
+[[tools-shell-create-project-default,Create Default Project]]
+=== Create Default Project Template ===
+This template sets up a 4 layer, Configuration, Infrastructure, Domain, Connectivity, command
line application.
+
+The template includes a small sample domain model, +Order+, +OrderItem+, +Customer+, but
there is no functionality
+added to it.
+
+A +SecurityRepository+ is also created, with a simple hardcoded implementation (+HardCodedSecurityRepositoryMixin+).
+
+[[tools-shell-create-project-restapp,Create Rest Application Project]]
+=== Create Rest Application Project Template ===
+This template sets up a 4 layer, Configuration, Infrastructure, Domain, Connectivity, restful
application. This
+application will use the <<library-restlet>> to create a full web application,
ready to deploy on a servlet
+container, such as Tomcat or Jetty.
+
+The template includes a small sample domain model, +Order+, +OrderItem+, +Customer+, and
have the CRUD operations
+for these already wired up to the restful +EndPoint+. Full HATEOAS is provided, so clients
don't need to construct
+URLs, but simply follow links and use forms.
+
+The template also creates a simple SecurityRepository and attaches the mechanisms in the
underlying Restlet
+implementation to do Authentication and Authorization (see SimpleEnroler and SimpleVerifier).
There are two
+hardcoded users with two hardcoded roles.
+
+-----------
+# name     password     roles
+  user       123        user
+  admin     secret      admin
+-----------
+


Mime
View raw message