polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [1/2] polygene-java git commit: Cleaning up in Yeoman generator. Generate nicer output. Fixed RdfIndexing to use VisibilityConfigIdentity assembler system, and follow Yeoman generator naming conventions.
Date Sat, 11 Mar 2017 11:53:14 GMT
Repository: polygene-java
Updated Branches:
  refs/heads/develop a2736a6df -> 41c759b2c


Cleaning up in Yeoman generator. Generate nicer output.
Fixed RdfIndexing to use VisibilityConfigIdentity assembler system, and follow Yeoman generator
naming conventions.


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

Branch: refs/heads/develop
Commit: 142980867d950f46dce1730de91d7315ac8d19e3
Parents: a2736a6
Author: niclas <niclas@spicter.com>
Authored: Sat Mar 11 19:41:48 2017 +0800
Committer: niclas <niclas@spicter.com>
Committed: Sat Mar 11 19:41:48 2017 +0800

----------------------------------------------------------------------
 .../ESFilesystemIndexQueryAssembler.java        |   3 -
 .../assembly/AbstractRdfIndexingAssembler.java  |  31 +++++
 .../rdf/assembly/RdfIndexingAssembler.java      |  28 +++++
 .../rdf/assembly/RdfMemoryStoreAssembler.java   |  19 +--
 .../assembly/RdfNativeSesameStoreAssembler.java |  27 +++--
 .../assembly/RdfRdbmsSesameStoreAssembler.java  |  22 ++--
 tools/generator-polygene/app/index.js           | 120 +++++++++++++------
 .../DomainLayer/DomainModule/Configuration.tmpl |   9 +-
 .../DomainLayer/DomainModule/Crud.tmpl          |   8 +-
 .../DomainLayer/DomainModule/Entity.tmpl        |   8 +-
 .../DomainLayer/DomainModule/Value.tmpl         |   8 +-
 .../DomainLayer/DomainModule/config.yaml.tmpl   |  23 ++++
 .../DomainLayer/DomainModule/module.js          |  17 ++-
 .../IndexingModule/bootstrap.tmpl               |   2 +-
 .../StorageModule/bootstrap.tmpl                |   2 +-
 15 files changed, 235 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java
b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java
index 6b529ca..015e2b0 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java
@@ -40,9 +40,6 @@ public class ESFilesystemIndexQueryAssembler
               .visibleIn( visibility() )
               .instantiateOnStartup();
 
-        module.services( OrgJsonValueSerializationService.class ).
-            taggedWith( ValueSerialization.Formats.JSON );
-
         if( hasConfig() )
         {
             configModule().entities( ElasticSearchConfiguration.class ).

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/AbstractRdfIndexingAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/AbstractRdfIndexingAssembler.java
b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/AbstractRdfIndexingAssembler.java
new file mode 100644
index 0000000..b67899e
--- /dev/null
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/AbstractRdfIndexingAssembler.java
@@ -0,0 +1,31 @@
+/*
+ *  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.
+ *
+ *
+ */
+package org.apache.polygene.index.rdf.assembly;
+
+import org.apache.polygene.bootstrap.Assemblers;
+
+public abstract class AbstractRdfIndexingAssembler<AssemblerType>
+    extends Assemblers.VisibilityIdentityConfig<AssemblerType>
+{
+    public AbstractRdfIndexingAssembler()
+    {
+        identifiedBy( "rdf-indexing" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfIndexingAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfIndexingAssembler.java
b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfIndexingAssembler.java
new file mode 100644
index 0000000..fff60a6
--- /dev/null
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfIndexingAssembler.java
@@ -0,0 +1,28 @@
+/*
+ *  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.
+ *
+ *
+ */
+package org.apache.polygene.index.rdf.assembly;
+
+/**
+ * This is a dummy Assembler to support the Yeoman Polygene Generator, which require naming
conventions for
+ * the systems that it supports.
+ */
+public class RdfIndexingAssembler extends RdfNativeSesameStoreAssembler
+{
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java
b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java
index be584c4..b4738db 100644
--- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java
@@ -21,8 +21,6 @@
 package org.apache.polygene.index.rdf.assembly;
 
 import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.value.ValueSerialization;
-import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.index.rdf.RdfIndexingEngineService;
@@ -30,23 +28,20 @@ import org.apache.polygene.index.rdf.query.RdfQueryParserFactory;
 import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
 import org.apache.polygene.library.rdf.entity.EntityTypeSerializer;
 import org.apache.polygene.library.rdf.repository.MemoryRepositoryService;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
 
-public class RdfMemoryStoreAssembler
-    implements Assembler
+public class RdfMemoryStoreAssembler extends AbstractRdfIndexingAssembler<RdfNativeSesameStoreAssembler>
 {
-    private Visibility indexingVisibility;
     private Visibility repositoryVisibility;
 
     public RdfMemoryStoreAssembler()
     {
-        this( Visibility.application, Visibility.module );
+        this(Visibility.application, Visibility.module);
     }
 
     public RdfMemoryStoreAssembler( Visibility indexingVisibility, Visibility repositoryVisibility
)
     {
-        this.indexingVisibility = indexingVisibility;
         this.repositoryVisibility = repositoryVisibility;
+        visibleIn( indexingVisibility );
     }
 
     @Override
@@ -55,14 +50,12 @@ public class RdfMemoryStoreAssembler
     {
         module.services( MemoryRepositoryService.class )
               .visibleIn( repositoryVisibility )
-              .instantiateOnStartup()
-              .identifiedBy( "rdf-repository" );
+              .instantiateOnStartup();
         module.services( RdfIndexingEngineService.class )
               .taggedWith( "rdf", "query", "indexing" )
-              .visibleIn( indexingVisibility )
+              .visibleIn( visibility() )
               .instantiateOnStartup();
-        module.services( RdfQueryParserFactory.class ).visibleIn( indexingVisibility );
-        module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON
);
+        module.services( RdfQueryParserFactory.class ).visibleIn( visibility() );
         module.objects( EntityStateSerializer.class, EntityTypeSerializer.class );
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java
b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java
index 79ca58a..57173db 100644
--- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java
@@ -20,31 +20,28 @@
 package org.apache.polygene.index.rdf.assembly;
 
 import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.value.ValueSerialization;
-import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.index.rdf.RdfIndexingEngineService;
 import org.apache.polygene.index.rdf.query.RdfQueryParserFactory;
 import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
 import org.apache.polygene.library.rdf.entity.EntityTypeSerializer;
+import org.apache.polygene.library.rdf.repository.NativeConfiguration;
 import org.apache.polygene.library.rdf.repository.NativeRepositoryService;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
 
-public class RdfNativeSesameStoreAssembler
-    implements Assembler
+public class RdfNativeSesameStoreAssembler extends AbstractRdfIndexingAssembler<RdfNativeSesameStoreAssembler>
 {
-    private Visibility indexingVisibility;
     private Visibility repositoryVisibility;
 
     public RdfNativeSesameStoreAssembler()
     {
-        this( Visibility.application, Visibility.module );
+        visibleIn( Visibility.application );
+        this.repositoryVisibility = Visibility.module;
     }
 
     public RdfNativeSesameStoreAssembler( Visibility indexingVisibility, Visibility repositoryVisibility
)
     {
-        this.indexingVisibility = indexingVisibility;
+        visibleIn( indexingVisibility );
         this.repositoryVisibility = repositoryVisibility;
     }
 
@@ -54,14 +51,18 @@ public class RdfNativeSesameStoreAssembler
     {
         module.services( NativeRepositoryService.class )
               .visibleIn( repositoryVisibility )
-              .instantiateOnStartup()
-              .identifiedBy( "rdf-indexing" );
+              .instantiateOnStartup();
         module.services( RdfIndexingEngineService.class )
               .taggedWith( "rdf", "query", "indexing" )
-              .visibleIn( indexingVisibility )
+              .visibleIn( visibility() )
               .instantiateOnStartup();
-        module.services( RdfQueryParserFactory.class ).visibleIn( indexingVisibility );
-        module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON
);
+        module.services( RdfQueryParserFactory.class ).visibleIn( visibility() );
         module.objects( EntityStateSerializer.class, EntityTypeSerializer.class );
+
+        if( hasConfig() )
+        {
+            configModule().entities( NativeConfiguration.class ).
+                visibleIn( configVisibility() );
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
index dcf9ffd..12e8681 100644
--- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
@@ -28,13 +28,13 @@ import org.apache.polygene.index.rdf.RdfIndexingEngineService;
 import org.apache.polygene.index.rdf.query.RdfQueryParserFactory;
 import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
 import org.apache.polygene.library.rdf.entity.EntityTypeSerializer;
+import org.apache.polygene.library.rdf.repository.NativeConfiguration;
+import org.apache.polygene.library.rdf.repository.RdbmsRepositoryConfiguration;
 import org.apache.polygene.library.rdf.repository.RdbmsRepositoryService;
 import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
 
-public class RdfRdbmsSesameStoreAssembler
-    implements Assembler
+public class RdfRdbmsSesameStoreAssembler  extends AbstractRdfIndexingAssembler<RdfNativeSesameStoreAssembler>
 {
-    private Visibility indexingVisibility;
     private Visibility repositoryVisibility;
 
     public RdfRdbmsSesameStoreAssembler()
@@ -44,7 +44,7 @@ public class RdfRdbmsSesameStoreAssembler
 
     public RdfRdbmsSesameStoreAssembler( Visibility indexingVisibility, Visibility repositoryVisibility
)
     {
-        this.indexingVisibility = indexingVisibility;
+        visibleIn( indexingVisibility );
         this.repositoryVisibility = repositoryVisibility;
     }
 
@@ -54,14 +54,18 @@ public class RdfRdbmsSesameStoreAssembler
     {
         module.services( RdbmsRepositoryService.class )
               .visibleIn( repositoryVisibility )
-              .instantiateOnStartup()
-              .identifiedBy( "rdf-indexing" );
+              .instantiateOnStartup();
         module.services( RdfIndexingEngineService.class )
               .taggedWith( "rdf", "query", "indexing" )
-              .visibleIn( indexingVisibility )
+              .visibleIn( visibility() )
               .instantiateOnStartup();
-        module.services( RdfQueryParserFactory.class ).visibleIn( indexingVisibility );
-        module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON
);
+        module.services( RdfQueryParserFactory.class ).visibleIn( visibility() );
         module.objects( EntityStateSerializer.class, EntityTypeSerializer.class );
+
+        if( hasConfig() )
+        {
+            configModule().entities( RdbmsRepositoryConfiguration.class ).
+                visibleIn( configVisibility() );
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/tools/generator-polygene/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/index.js b/tools/generator-polygene/app/index.js
index 7f76c10..583edbf 100644
--- a/tools/generator-polygene/app/index.js
+++ b/tools/generator-polygene/app/index.js
@@ -31,10 +31,32 @@ module.exports = generators.Base.extend(
             // Calling the super constructor is important so our generator is correctly set
up
             generators.Base.apply(this, arguments);
 
-            this.option('import-model'); // --import-model reads model.json in current directory
and creates the domain model for it.
+            this.option('import-model', {
+                name: "import",
+                desc: 'Reads a model file and creates the domain model for it.',
+                type: String,
+                default: "./model.json",
+                hide: false
+            });
+
+            this.option('export-model', {
+                name: "export",
+                desc: 'Writes the model of the application into a json file.',
+                type: String,
+                default: "exported-model",
+                hide: false
+            });
+
+            this.option('noPrompt', {
+                name: "noPrompt",
+                desc: 'If specified, the interactive prompts will be disabled.',
+                type: Boolean,
+                default: false,
+                hide: false
+            });
 
-            if (this.options.import != null) {
-                polygene = importModel(this, './imported-model.json');
+            if (this.options.import) {
+                polygene = importModel(this.options.import);
                 polygene.name = polygene.name ? polygene.name : firstUpper(this.appname);
                 polygene.packageName = polygene.packageName ? polygene.packageName : ("com.acme."
+ this.appname);
                 polygene.singletonApp = false;  // not supported yet
@@ -44,13 +66,12 @@ module.exports = generators.Base.extend(
                 polygene.entitystore = polygene.entitystore ? polygene.entitystore : null;
                 polygene.caching = polygene.caching ? polygene.caching : null;
                 polygene.serialization = polygene.serialization ? polygene.serialization
: null;
-                console.log(JSON.stringify(polygene, null, 4));
             }
             assignFunctions(polygene);
         },
 
         prompting: function () {
-            if (this.options.noPrompt != null) {
+            if (this.options.noPrompt) {
                 return this.prompt([]);
             }
             else {
@@ -194,8 +215,8 @@ module.exports = generators.Base.extend(
             });
             var buildToolChain = require(__dirname + '/templates/buildtool/build.js');
             buildToolChain.write(polygene);
-            if (this.options.export != null) {
-                exportModel(this, "exported-model.json");
+            if (this.options.export) {
+                exportModel(this.options.export);
             }
         }
     }
@@ -226,11 +247,17 @@ function firstUpper(text) {
     return text.charAt(0).toUpperCase() + text.substring(1);
 }
 
-function importModel(ctx, filename) {
+function importModel(filename) {
+    if ( typeof filename !== 'string' ) {
+        filename = "./model.json";
+    }
     return JSON.parse(fs.readFileSync(filename, 'utf8'));
 }
 
-function exportModel(ctx, filename) {
+function exportModel(filename) {
+    if ( typeof filename !== 'string' ) {
+        filename = "exported-model.json";
+    }
     delete polygene.current;
     return fs.writeFileSync(filename, JSON.stringify(polygene, null, 4) + "\n", 'utf8');
 }
@@ -238,7 +265,6 @@ function exportModel(ctx, filename) {
 function assignFunctions(polygene) {
 
     polygene.hasFeature = function (feature) {
-        console.log(polygene.features);
         return polygene.features.indexOf(feature) >= 0;
     };
 
@@ -287,17 +313,17 @@ function assignFunctions(polygene) {
     polygene.firstUpper = function (text) {
         return text.charAt(0).toUpperCase() + text.substring(1);
     };
-    polygene.typeNameOnly = function(text) {
+    polygene.typeNameOnly = function (text) {
         var lastPos = text.lastIndexOf(".");
-        if( lastPos < 0 ) {
+        if (lastPos < 0) {
             return text;
         }
         return text.substring(lastPos + 1);
     };
 
-    polygene.configurationClassName = function( clazzName ) {
-        if( clazzName.endsWith( "Service" )) {
-            clazzName = clazzName.substring(0, clazzName.length - 7 );
+    polygene.configurationClassName = function (clazzName) {
+        if (clazzName.endsWith("Service")) {
+            clazzName = clazzName.substring(0, clazzName.length - 7);
         }
         return clazzName + "Configuration";
     };
@@ -306,36 +332,36 @@ function assignFunctions(polygene) {
         var state = [];
         var imported = {};
         var props = current.clazz.properties;
-        if( props ) {
-            for( var idx in props ) {
+        if (props) {
+            for (var idx in props) {
                 var prop = props[idx];
-                state.push( 'Property' + '<' + polygene.typeNameOnly(prop.type) + ">
" + prop.name + "();")
+                state.push('Property' + '<' + polygene.typeNameOnly(prop.type) + ">
" + prop.name + "();")
                 imported[prop.type] = imported[prop.type];
             }
         } else {
-            state.push( 'Property<String> name();    // TODO: remove sample property')
+            state.push('Property<String> name();    // TODO: remove sample property')
         }
         var assocs = current.clazz.associations;
-        if( assocs ) {
-            for( var idx in assocs ) {
+        if (assocs) {
+            for (var idx in assocs) {
                 var assoc = assocs[idx];
-                state.push("Association" + '<' +  polygene.typeNameOnly(assoc.type) +
'>' + assoc.name + "();")
-                imported[assoc.type] = imported[assoc.type] ;
+                state.push("Association" + '<' + polygene.typeNameOnly(assoc.type) + '>'
+ assoc.name + "();")
+                imported[assoc.type] = imported[assoc.type];
             }
         }
         assocs = current.clazz.manyassociations;
-        if( assocs ) {
-            for( var idx in assocs ) {
+        if (assocs) {
+            for (var idx in assocs) {
                 var assoc = assocs[idx];
-                state.push("ManyAssociation<" +  polygene.typeNameOnly(assoc.type) + ">"
+ assoc.name + "();")
-                imported[assoc.type] = imported[assoc.type] ;
+                state.push("ManyAssociation<" + polygene.typeNameOnly(assoc.type) + ">"
+ assoc.name + "();")
+                imported[assoc.type] = imported[assoc.type];
             }
         }
         assocs = current.clazz.namedassociations;
-        if( assocs ) {
-            for( var idx in assocs ) {
+        if (assocs) {
+            for (var idx in assocs) {
                 var assoc = assocs[idx];
-                state.push("NamedAssociation<" +  polygene.typeNameOnly(assoc.type) +
">" + assoc.name + "();")
+                state.push("NamedAssociation<" + polygene.typeNameOnly(assoc.type) + ">"
+ assoc.name + "();")
                 imported[assoc.type] = imported[assoc.type];
             }
         }
@@ -345,18 +371,44 @@ function assignFunctions(polygene) {
 
     polygene.prepareConfigClazz = function (current) {
         var state = [];
+        var yaml = [];
         var imported = {};
         var props = current.clazz.configuration;
-        if( props ) {
-            for( var idx in props ) {
+        if (props) {
+            for (var idx in props) {
                 var prop = props[idx];
-                state.push( 'Property' + '<' + polygene.typeNameOnly(prop.type) + ">
" + prop.name + "();")
+                state.push('Property' + '<' + polygene.typeNameOnly(prop.type) + ">
" + prop.name + "();")
                 imported[prop.type] = imported[prop.type];
+                var yamlDefault;
+                if( prop.type === "java.lang.String" ) {
+                    yamlDefault = '""';
+                }
+                else if( prop.type === "java.lang.Boolean" ) {
+                    yamlDefault = 'false';
+                }
+                else if( prop.type === "java.lang.Long" ) {
+                    yamlDefault = '0';
+                }
+                else if( prop.type === "java.lang.Integer" ) {
+                    yamlDefault = '0';
+                }
+                else if( prop.type === "java.lang.Double" ) {
+                    yamlDefault = '0.0';
+                }
+                else if( prop.type === "java.lang.Float" ) {
+                    yamlDefault = '0.0';
+                }
+                else {
+                    yamlDefault = '\n    # TODO: complex configuration type. ';
+                }
+                yaml.push( prop.name + " : " + yamlDefault);
             }
         } else {
-            state.push( 'Property<String> name();    // TODO: remove sample property')
+            state.push('Property<String> name();    // TODO: remove sample property')
+            yaml.push( 'name : "sample config value"' );
         }
         current.state = state;
+        current.yaml = yaml;
         current.imported = imported;
     };
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
index 14c9735..071ee7b 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
@@ -19,19 +19,18 @@
 -%>
 package <%= packageName %>.model.<%= polygene.current.name %>;
 
-import org.apache.polygene.api.injection.scope.This;
-import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.property.Property;
 <%
 for( var prop in polygene.current.imported ) {
     if( !prop.startsWith( "java.lang" )) {
-        %><%- "import " + prop + ";"; %><%
+        %><%- "import " + prop + ";"; %>
+<%
     }
 } %>
 
 public interface <%= polygene.current.clazz.name %>
 {
-<% for( var idx in polygene.current.state ) { %>
-    <%- polygene.current.state[idx]; %>
+<% for( var idx in polygene.current.state ) {
+%>    <%- polygene.current.state[idx]; %>
 <% } %>
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
index ecec763..df53506 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
@@ -34,10 +34,10 @@ public interface <%= polygene.current.clazz.name %>
 {
     interface State
     {
-<% for( var idx in polygene.current.state ) { %>
-        <%- polygene.current.state[idx]; %>
-<% } %>
-    }
+<% for( var idx in polygene.current.state ) {
+%>        <%- polygene.current.state[idx]; %>
+<% }
+%>    }
 
     class Mixin
         implements <%= polygene.current.clazz.name %>

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
index ecec763..df53506 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
@@ -34,10 +34,10 @@ public interface <%= polygene.current.clazz.name %>
 {
     interface State
     {
-<% for( var idx in polygene.current.state ) { %>
-        <%- polygene.current.state[idx]; %>
-<% } %>
-    }
+<% for( var idx in polygene.current.state ) {
+%>        <%- polygene.current.state[idx]; %>
+<% }
+%>    }
 
     class Mixin
         implements <%= polygene.current.clazz.name %>

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
index c4194e7..34a95b0 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
@@ -34,10 +34,10 @@ public interface <%= polygene.current.clazz.name %>
 {
     interface State
     {
-<% for( var idx in polygene.current.state ) { %>
-        <%- polygene.current.state[idx]; %>
-<% } %>
-    }
+<% for( var idx in polygene.current.state ) {
+%>        <%- polygene.current.state[idx]; %>
+<% }
+%>    }
 
     class Mixin
         implements <%= polygene.current.clazz.name %>

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/tools/generator-polygene/app/templates/DomainLayer/DomainModule/config.yaml.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/config.yaml.tmpl
b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/config.yaml.tmpl
new file mode 100644
index 0000000..e2629d5
--- /dev/null
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/config.yaml.tmpl
@@ -0,0 +1,23 @@
+<%#
+ *  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.
+ *
+ *
+-%>
+-
+<% for( var idx in polygene.current.yaml ) {
+%>    <%- polygene.current.yaml[idx]; %>
+<% } %>

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
index 0c6f1eb..27b0a4f 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
@@ -29,6 +29,8 @@ function copyPolygeneDomainModule(p, moduleName, moduleDef) {
     copyComposites(p, moduleDef.objects, "Object");
     copyComposites(p, moduleDef.services, "Service");
     copyComposites(p, moduleDef.services, "Configuration");
+
+    copyConfigurationYaml(p, moduleDef.services )
 }
 
 function copyComposites(p, composites, type) {
@@ -46,4 +48,17 @@ function copyComposites(p, composites, type) {
                 'model/src/main/java/' + p.javaPackageDir + '/model/' + p.current.name  +
'/' + p.current.clazz.name + '.java');
         }
     }
-}
\ No newline at end of file
+}
+
+function copyConfigurationYaml(p, composites) {
+    for (var idx in composites) {
+        if (composites.hasOwnProperty(idx)) {
+            p.current.clazz = composites[idx];
+            p.prepareClazz(p.current);
+            p.copyTemplate(p.ctx,
+                'DomainLayer/DomainModule/config.yaml.tmpl',
+                'model/src/main/resources/' + p.javaPackageDir + '/model/' + p.current.name
+ '/' + p.current.clazz.name + '.yaml');
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl
b/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl
index a1f9479..c7e1975 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl
@@ -43,7 +43,7 @@ public class <%- polygene.indexing %>IndexingModule
     {
         new <%- polygene.indexing %>IndexingAssembler()
             .visibleIn( Visibility.application )
-            .identifiedBy( "indexing-<%- polygene.indexing %>" )
+            .identifiedBy( "indexing-<%- polygene.indexing.toLowerCase() %>" )
             .withConfig( configModule, Visibility.application )
             .assemble( module );
         return module;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/14298086/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
index 8e68e2f..997fe3b 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
@@ -44,7 +44,7 @@ public class <%- polygene.entitystore %>StorageModule
         new <%- polygene.entitystore %>EntityStoreAssembler()
             .visibleIn( Visibility.application  )
             .withConfig( configModule, Visibility.application )
-            .identifiedBy( "entitystore-<%- polygene.entitystore %>" )
+            .identifiedBy( "entitystore-<%- polygene.entitystore.toLowerCase() %>"
)
             .assemble( module );
         return module;
     }


Mime
View raw message