You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/04/16 07:38:51 UTC
[1/5] zest-java git commit: Forgotten to call the super.assemble() in
other serialization tests.
Repository: zest-java
Updated Branches:
refs/heads/develop 09facf1aa -> 0accd2cf6
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestappProjectCreatorTest.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestappProjectCreatorTest.java b/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestappProjectCreatorTest.java
new file mode 100644
index 0000000..4cf8431
--- /dev/null
+++ b/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestappProjectCreatorTest.java
@@ -0,0 +1,119 @@
+/*
+ * 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.zest.tools.shell.create.project;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.zest.tools.shell.FileUtils;
+import org.apache.zest.tools.shell.TestHelper;
+import org.junit.Test;
+
+import static org.apache.zest.tools.shell.FileUtils.removeDir;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+
+public class RestAppProjectCreatorTest
+{
+ private RestAppProjectCreator underTest = new RestAppProjectCreator();
+
+ @Test
+ public void givenCorrectInputWhenCreatedProjectExpectCompleteProjectCreated()
+ throws Exception
+ {
+
+ TestHelper.zetZestZome();
+ File projectDir = new File( "ZestTest" );
+ if( projectDir.exists() )
+ {
+ removeDir( projectDir );
+ }
+ Map<String, String> properties = new HashMap<>();
+ properties.put( "zest.home", System.getProperty( "zest.home" ) );
+ properties.put( "root.package", "org.apache.zest.test" );
+ properties.put( "project.dir", "ZestTest" );
+ properties.put( "project.name", "ZestTest" );
+ properties.put( "template.dir", "etc/templates/restapp/files" );
+ underTest.create( "ZestTest", projectDir, properties );
+
+ assertThat( projectDir.exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/build.gradle" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src/main/resources" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src/main/java/org/apache/zest/test/app/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src/main/java/org/apache/zest/test/app/ZestTest.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src/main/webapp/WEB-INF/web.xml" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/ConfigModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/ConfigurationLayer.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/connectivity/ConnectivityLayer.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/connectivity/RestModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/connectivity/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/CrudModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/DomainLayer.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/OrderModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/SecurityModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/FileConfigurationModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/IndexingModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/InfrastructureLayer.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/SerializationModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/StorageModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/ZestTestApplicationAssembler.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/resources" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/build.gradle" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/build.gradle" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/resources" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/Customer.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/Order.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/OrderItem.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/HardcodedSecurityRepositoryMixin.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/SecurityRepository.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "rest/build.gradle" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "rest/src" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "rest/src/main/resources" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "rest/src/main/java/org/apache/zest/test/rest/security/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "rest/src/main/java/org/apache/zest/test/rest/security/SimpleEnroler.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "rest/src/main/java/org/apache/zest/test/rest/security/SimpleVerifier.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "rest/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "gradle/wrapper/gradle-wrapper.jar" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "gradle/wrapper/gradle-wrapper.properties" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "gradlew" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "gradlew.bat" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "build.gradle" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "settings.gradle" ).exists(), equalTo( true ) );
+ if( FileUtils.removeDir( projectDir ) )
+ {
+ System.err.println( "Unable to remove file. Why???" );
+ }
+ assertThat( projectDir.exists(), equalTo( false ) );
+ }
+}
[3/5] zest-java git commit: Forgotten to call the super.assemble() in
other serialization tests.
Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/DomainLayerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/DomainLayerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/DomainLayerWriter.java
new file mode 100644
index 0000000..f3fe430
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/DomainLayerWriter.java
@@ -0,0 +1,82 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class DomainLayerWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.domain;" );
+ pw.println();
+ pw.println(
+ "import java.util.function.Function;\n" +
+ "import org.apache.zest.api.structure.Application;\n" +
+ "import org.apache.zest.api.structure.Module;\n" +
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.LayerAssembler;\n" +
+ "import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;\n" +
+ "\n" +
+ "public class DomainLayer extends LayeredLayerAssembler\n" +
+ " implements LayerAssembler\n" +
+ "{\n" +
+ " @Override\n" +
+ " public LayerAssembly assemble(LayerAssembly layer)\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " createModule( layer, CrudModule.class );\n" +
+ " createModule( layer, OrderModule.class ); // This is a simple sample that you typically remove.\n" +
+ " createModule( layer, SecurityModule.class ); // This is a simple sample that you typically remove.\n" +
+ " return layer;\n" +
+ " }\n" +
+ "\n" +
+ " public static Function<Application, Module> typeFinder()\n" +
+ " {\n" +
+ " return application -> application.findModule( \"Domain Layer\", \"Assets Module\" );\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/domain/";
+ String classname = "DomainLayer";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/FileConfigurationModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/FileConfigurationModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/FileConfigurationModuleWriter.java
new file mode 100644
index 0000000..dca5052
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/FileConfigurationModuleWriter.java
@@ -0,0 +1,76 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class FileConfigurationModuleWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.infrastructure;" );
+ pw.println();
+ pw.println(
+ "import org.apache.zest.api.common.Visibility;\n" +
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
+ "import org.apache.zest.library.fileconfig.FileConfigurationAssembler;\n" +
+ "\n" +
+ "public class FileConfigurationModule\n" +
+ " implements ModuleAssembler\n" +
+ "{\n" +
+ " public static String NAME;\n" +
+ "\n" +
+ " @Override\n" +
+ " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " new FileConfigurationAssembler().visibleIn( Visibility.layer ).assemble( module );\n" +
+ " return module;\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/infrastructure/";
+ String classname = "FileConfigurationModule";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/HardCodedSecurityRepositoryMixinWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/HardCodedSecurityRepositoryMixinWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/HardCodedSecurityRepositoryMixinWriter.java
new file mode 100644
index 0000000..a1e1fb9
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/HardCodedSecurityRepositoryMixinWriter.java
@@ -0,0 +1,87 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class HardCodedSecurityRepositoryMixinWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".model.security;" );
+ pw.println();
+ pw.println(
+ "import java.util.Collections;\n" +
+ "import java.util.List;\n" +
+ "import org.apache.zest.api.unitofwork.concern.UnitOfWorkPropagation;\n" +
+ "\n" +
+ "public class HardcodedSecurityRepositoryMixin\n" +
+ " implements SecurityRepository\n" +
+ "{\n" +
+ "\n" +
+ " @Override\n" +
+ " public boolean verifyPassword( String userName, String password )\n" +
+ " {\n" +
+ " if( userName.equals(\"admin\") && password.equals(\"secret\") )" +
+ " {\n" +
+ " return true;\n" +
+ " }\n" +
+ " if( userName.equals(\"user\") && password.equals(\"123\") )" +
+ " {\n" +
+ " return true;\n" +
+ " }\n" +
+ " return false;\n" +
+ " }\n" +
+ "\n" +
+ " @UnitOfWorkPropagation\n" +
+ " public List<String> findRoleNamesOfUser( String name )\n" +
+ " {\n" +
+ " if( \"admin\".equals( name ) )\n" +
+ " {\n" +
+ " return Collections.singletonList(\"admin\");\n" +
+ " }\n" +
+ " return Collections.singletonList(\"user\");\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/model/security/";
+ String classname = "HardcodedSecurityRepositoryMixin";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "model/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/IndexingModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/IndexingModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/IndexingModuleWriter.java
new file mode 100644
index 0000000..20790a9
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/IndexingModuleWriter.java
@@ -0,0 +1,86 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class IndexingModuleWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.infrastructure;" );
+ pw.println();
+ pw.println(
+ "import org.apache.zest.api.common.Visibility;\n" +
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
+ "import org.apache.zest.index.rdf.assembly.RdfNativeSesameStoreAssembler;\n" +
+ "import org.apache.zest.library.rdf.repository.NativeConfiguration;\n" +
+ "\n" +
+ "public class IndexingModule\n" +
+ " implements ModuleAssembler\n" +
+ "{\n" +
+ " public static final String NAME = \"Indexing Module\";\n" +
+ " private final ModuleAssembly configModule;\n" +
+ "\n" +
+ " public IndexingModule( ModuleAssembly configModule )\n" +
+ " {\n" +
+ " this.configModule = configModule;\n" +
+ " }\n" +
+ "\n" +
+ " @Override\n" +
+ " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " module.withDefaultUnitOfWorkFactory();\n" +
+ "\n" +
+ " configModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application );\n" +
+ " new RdfNativeSesameStoreAssembler(Visibility.application, Visibility.module).assemble( module );\n" +
+ " return module;\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/infrastructure/";
+ String classname = "IndexingModule";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/InfrastructureLayerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/InfrastructureLayerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/InfrastructureLayerWriter.java
new file mode 100644
index 0000000..9da967f
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/InfrastructureLayerWriter.java
@@ -0,0 +1,91 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class InfrastructureLayerWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.infrastructure;" );
+ pw.println();
+ pw.println(
+ "import java.util.function.Function;\n" +
+ "import org.apache.zest.api.structure.Application;\n" +
+ "import org.apache.zest.api.structure.Module;\n" +
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.LayerAssembler;\n" +
+ "import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;\n" +
+ "\n" +
+ "public class InfrastructureLayer extends LayeredLayerAssembler\n" +
+ " implements LayerAssembler\n" +
+ "{\n" +
+ " public static final String NAME = \"Infrastructure Layer\";\n" +
+ " private final ModuleAssembly configModule;\n" +
+ " private final Function<Application, Module> typeFinder;\n" +
+ "\n" +
+ " public InfrastructureLayer( ModuleAssembly configModule, Function<Application, Module> typeFinder )\n" +
+ " {\n" +
+ " this.configModule = configModule;\n" +
+ " this.typeFinder = typeFinder;\n" +
+ " }\n" +
+ "\n" +
+ " @Override\n" +
+ " public LayerAssembly assemble( LayerAssembly layer )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " createModule( layer, FileConfigurationModule.class );\n" +
+ "\n" +
+ " new StorageModule( configModule ).assemble( layer, layer.module( StorageModule.NAME ) );\n" +
+ " new IndexingModule( configModule ).assemble( layer, layer.module( IndexingModule.NAME ) );\n" +
+ " new SerializationModule( typeFinder ).assemble( layer, layer.module( SerializationModule.NAME ) );\n" +
+ "\n" +
+ " return layer;\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/infrastructure/";
+ String classname = "InfrastructureLayer";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderItemWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderItemWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderItemWriter.java
new file mode 100644
index 0000000..28f22b8
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderItemWriter.java
@@ -0,0 +1,66 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class OrderItemWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".model.orders;" );
+ pw.println();
+ pw.println("import java.math.BigDecimal;");
+ pw.println("import org.apache.zest.api.entity.Identity;");
+ pw.println("import org.apache.zest.api.property.Property;");
+ pw.println();
+ pw.println(
+ "public interface OrderItem extends Identity\n" +
+ "{\n" +
+ " Property<String> partNumber();\n\n" +
+ " Property<BigDecimal> unitPrice();\n\n" +
+ " Property<Integer> units();\n\n" +
+ " Property<BigDecimal> discount();\n\n" +
+ "}\n");
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/model/orders/";
+ String classname = "OrderItem";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "model/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderModuleWriter.java
new file mode 100644
index 0000000..47d22a9
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderModuleWriter.java
@@ -0,0 +1,85 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+import static java.lang.String.format;
+
+public class OrderModuleWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.domain;" );
+ pw.println();
+ pw.println(
+ "import org.apache.zest.api.common.Visibility;\n" +
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.ModuleAssembler;");
+ pw.println(format("import %s.model.orders.Order;", rootPackage));
+ pw.println(format("import %s.model.orders.OrderItem;", rootPackage));
+ pw.println(format("import %s.model.orders.Customer;", rootPackage));
+ pw.println();
+ pw.println(
+ "public class OrderModule\n" +
+ " implements ModuleAssembler\n" +
+ "{\n" +
+ " public static String NAME;\n" +
+ "\n" +
+ " @Override\n" +
+ " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " module.values( /* add value types */ );\n" +
+ " module.entities( Customer.class, Order.class, OrderItem.class );\n" +
+ " module.services( /* add services */ )\n" +
+ " .visibleIn( Visibility.layer )\n" +
+ " .instantiateOnStartup();\n" +
+ " return module;\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/domain/";
+ String classname = "OrderModule";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderWriter.java
new file mode 100644
index 0000000..550f0ec
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/OrderWriter.java
@@ -0,0 +1,71 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class OrderWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".model.orders;" );
+ pw.println();
+ pw.println("import java.time.ZonedDateTime;");
+ pw.println("import org.apache.zest.api.association.Association;");
+ pw.println("import org.apache.zest.api.association.ManyAssociation;");
+ pw.println("import org.apache.zest.api.common.Optional;");
+ pw.println("import org.apache.zest.api.entity.Identity;");
+ pw.println("import org.apache.zest.api.property.Property;");
+ pw.println();
+ pw.println(
+ "public interface Order extends Identity\n" +
+ "{\n" +
+ " Property<String> orderNumber();\n\n" +
+ " Property<ZonedDateTime> registered();\n\n" +
+ " @Optional\n" +
+ " Property<ZonedDateTime> shipped();\n\n" +
+ " Association<Customer> customer();\n\n" +
+ " ManyAssociation<OrderItem> items();\n\n" +
+ "}\n");
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/model/orders/";
+ String classname = "Order";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "model/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SecurityModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SecurityModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SecurityModuleWriter.java
new file mode 100644
index 0000000..3f576f1
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SecurityModuleWriter.java
@@ -0,0 +1,88 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+import static java.lang.String.format;
+
+public class SecurityModuleWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.domain;" );
+ pw.println();
+ pw.println(
+ "import org.apache.zest.api.common.Visibility;\n" +
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.ModuleAssembler;");
+ pw.println(format("import %s.model.orders.Order;", rootPackage));
+ pw.println(format("import %s.model.orders.OrderItem;", rootPackage));
+ pw.println(format("import %s.model.orders.Customer;", rootPackage));
+ pw.println(format("import %s.model.security.SecurityRepository;", rootPackage));
+ pw.println(format("import %s.model.security.HardcodedSecurityRepositoryMixin;", rootPackage));
+ pw.println();
+ pw.println(
+ "public class SecurityModule\n" +
+ " implements ModuleAssembler\n" +
+ "{\n" +
+ " public static String NAME;\n" +
+ "\n" +
+ " @Override\n" +
+ " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " module.withDefaultUnitOfWorkFactory();\n" +
+ " module.services( SecurityRepository.class )\n" +
+ " .withMixins( HardcodedSecurityRepositoryMixin.class )\n" +
+ " .visibleIn( Visibility.application )\n" +
+ " .instantiateOnStartup();\n" +
+ "\n" +
+ " return module;\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/domain/";
+ String classname = "SecurityModule";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SecurityRepositoryWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SecurityRepositoryWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SecurityRepositoryWriter.java
new file mode 100644
index 0000000..989811f
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SecurityRepositoryWriter.java
@@ -0,0 +1,71 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+import static java.lang.String.format;
+
+public class SecurityRepositoryWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".model.security;" );
+ pw.println();
+ pw.println(
+ "import java.util.List;\n" +
+ "import org.apache.zest.api.concern.Concerns;\n" +
+ "import org.apache.zest.api.unitofwork.concern.UnitOfWorkConcern;\n" +
+ "import org.apache.zest.api.unitofwork.concern.UnitOfWorkPropagation;\n" +
+ "\n" +
+ "@Concerns( UnitOfWorkConcern.class )\n" +
+ "public interface SecurityRepository\n" +
+ "{\n" +
+ " @UnitOfWorkPropagation\n" +
+ " boolean verifyPassword( String user, String password );\n" +
+ "\n" +
+ " @UnitOfWorkPropagation\n" +
+ " List<String> findRoleNamesOfUser( String name );\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/model/security/";
+ String classname = "SecurityRepository";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "model/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SerializationModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SerializationModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SerializationModuleWriter.java
new file mode 100644
index 0000000..6dba0de
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SerializationModuleWriter.java
@@ -0,0 +1,90 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class SerializationModuleWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.infrastructure;" );
+ pw.println();
+ pw.println(
+ "import java.util.function.Function;\n" +
+ "import org.apache.zest.api.common.Visibility;\n" +
+ "import org.apache.zest.api.structure.Application;\n" +
+ "import org.apache.zest.api.structure.Module;\n" +
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
+ "import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;\n" +
+ "import org.apache.zest.valueserialization.jackson.JacksonValueSerializationAssembler;\n" +
+ "\n" +
+ "public class SerializationModule\n" +
+ " implements ModuleAssembler\n" +
+ "{\n" +
+ " public static final String NAME = \"Serialization Module\";\n" +
+ " private final Function<Application, Module> typeFinder;\n" +
+ "\n" +
+ " public SerializationModule( Function<Application, Module> typeFinder )\n" +
+ " {\n" +
+ " this.typeFinder = typeFinder;\n" +
+ " }\n" +
+ "\n" +
+ " @Override\n" +
+ " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " new JacksonValueSerializationAssembler()\n" +
+ " .visibleIn( Visibility.application )\n" +
+ " .withValuesModuleFinder( typeFinder )\n" +
+ " .assemble( module );\n" +
+ " module.services( UuidIdentityGeneratorService.class ).visibleIn( Visibility.layer );\n" +
+ " return module;\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/infrastructure/";
+ String classname = "SerializationModule";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SettingsWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SettingsWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SettingsWriter.java
new file mode 100644
index 0000000..ddfa388
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/SettingsWriter.java
@@ -0,0 +1,75 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class SettingsWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.println(
+ String.format(
+ "\n" +
+ "include 'app',\n" +
+ " 'bootstrap',\n" +
+ " 'model',\n" +
+ " 'rest'\n" +
+ "\n" +
+ "rootProject.name = \"%s\"\n" +
+ "\n" +
+ "validateProject(rootProject, \"\")\n" +
+ "\n" +
+ "def validateProject(project, parentName)\n" +
+ "{\n" +
+ " assert project.projectDir.isDirectory()\n" +
+ " if( new File(\"$project.projectDir/src/main/java\").exists() )\n" +
+ " {\n" +
+ " assert project.buildFile.isFile()\n" +
+ " }\n" +
+ " if( parentName.length() > 0 )\n" +
+ " println \"Project: \" + project.name\n" +
+ " project.children.each { child ->\n" +
+ " validateProject(child, project.name)\n" +
+ " }\n" +
+ "}\n" +
+ "\n", projectName
+ ));
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "settings.gradle" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/StorageModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/StorageModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/StorageModuleWriter.java
new file mode 100644
index 0000000..c9123a8
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/StorageModuleWriter.java
@@ -0,0 +1,87 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class StorageModuleWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.infrastructure;" );
+ pw.println();
+ pw.println(
+ "import org.apache.zest.api.common.Visibility;\n" +
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
+ "import org.apache.zest.entitystore.file.assembly.FileEntityStoreAssembler;\n" +
+ "\n" +
+ "public class StorageModule\n" +
+ " implements ModuleAssembler\n" +
+ "{\n" +
+ " public static final String NAME = \"Storage Module\";\n" +
+ " private final ModuleAssembly configModule;\n" +
+ "\n" +
+ " public StorageModule( ModuleAssembly configModule )\n" +
+ " {\n" +
+ " this.configModule = configModule;\n" +
+ " }\n" +
+ "\n" +
+ " @Override\n" +
+ " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ "\n" +
+ " new FileEntityStoreAssembler()\n" +
+ " .visibleIn( Visibility.application )\n" +
+ " .withConfig( configModule, Visibility.application )\n" +
+ " .identifiedBy( \"filestore\" )\n" +
+ " .assemble( module );\n" +
+ " return module;\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/infrastructure/";
+ String classname = "StorageModule";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/defaultp/ApplicationWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/defaultp/ApplicationWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/defaultp/ApplicationWriter.java
new file mode 100644
index 0000000..c2cfc4f
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/defaultp/ApplicationWriter.java
@@ -0,0 +1,106 @@
+/*
+ * 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.zest.tools.shell.create.project.defaultp;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+import org.apache.zest.bootstrap.ApplicationAssembler;
+import org.apache.zest.bootstrap.Energy4Java;
+
+import static java.lang.String.format;
+
+public class ApplicationWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".app;" );
+ pw.println();
+ pw.println( "import java.lang.reflect.UndeclaredThrowableException;" );
+ pw.println( "import org.apache.zest.api.structure.Application;" );
+ pw.println( "import org.apache.zest.api.structure.Module;" );
+ pw.println( "import org.apache.zest.bootstrap.AssemblyException;" );
+ pw.println( "import org.apache.zest.bootstrap.Energy4Java;" );
+ pw.println( "import org.apache.zest.bootstrap.layered.LayeredApplicationAssembler;" );
+ pw.println( "import org.apache.zest.library.restlet.ZrestApplication;" );
+ pw.println( format( "import %s.bootstrap.%sApplicationAssembler;", rootPackage, projectName ) );
+ pw.println( format( "import %s.model.security.SecurityRepository;", rootPackage ) );
+ pw.println();
+ pw.println( format( "public class %s", projectName ) );
+ pw.println( "{\n" );
+ pw.println( " private static Energy4Java zest;" );
+ pw.println( " private static Application app;" );
+ pw.println();
+
+ pw.println( " private static void registerShutdownHook()" );
+ pw.println( " {" );
+ pw.println( " Runtime.getRuntime().addShutdownHook( new Thread( new Runnable()\n" +
+ " {\n" +
+ " @Override\n" +
+ " public void run()\n" +
+ " {\n" +
+ " try\n" +
+ " {\n" +
+ " app.passivate();\n" +
+ " }\n" +
+ " catch( Exception e )\n" +
+ " {\n" +
+ " System.err.println( \"Clean Shutdown of application failed.\" );\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " }\n" +
+ " }, \"Shutdown Hook for Zest\" ) );\n" );
+ pw.println( " }\n" );
+ pw.println( " public static void main( String[] args )" );
+ pw.println( " {" );
+ pw.println( " zest = new Energy4Java();" );
+ pw.println( format(" app = zest.newApplication( new %sApplicationAssembler() );", projectName) );
+ pw.println( " registerShutdownHook();" );
+ pw.println( " app.activate();\n" );
+ pw.println();
+ pw.println( " // Example interfacing" );
+ pw.println( " Module securityModule = app.findModule( \"DomainLayer\", \"SecurityModule\" );" );
+ pw.println( " SecurityRepository = securityModule.serviceFinder().findService( SecurityRepository.class );" );
+ pw.println( " }\n" );
+ pw.println( "}" );
+ pw.println();
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/app/";
+ String classname = properties.get("project.name");
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "app/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ApplicationAssemblerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ApplicationAssemblerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ApplicationAssemblerWriter.java
deleted file mode 100644
index 0cdefc1..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ApplicationAssemblerWriter.java
+++ /dev/null
@@ -1,105 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class ApplicationAssemblerWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap;" );
- pw.println();
- pw.println( "import java.io.IOException;" );
- pw.println( "import java.nio.file.Files;" );
- pw.println( "import java.nio.file.Path;" );
- pw.println( "import java.nio.file.Paths;" );
- pw.println( "import java.util.function.Function;" );
- pw.println();
- pw.println( "import org.apache.zest.api.structure.Application;" );
- pw.println( "import org.apache.zest.api.structure.Module;\n" );
- pw.println( "import org.apache.zest.bootstrap.ApplicationAssembly;" );
- pw.println( "import org.apache.zest.bootstrap.AssemblyException;" );
- pw.println( "import org.apache.zest.bootstrap.LayerAssembly;" );
- pw.println( "import org.apache.zest.bootstrap.ModuleAssembly;" );
- pw.println( "import org.apache.zest.bootstrap.layered.LayeredApplicationAssembler;" );
- pw.println();
- pw.println( "import " + rootPackage + ".bootstrap.connectivity.ConnectivityLayer;" );
- pw.println( "import " + rootPackage + ".bootstrap.domain.DomainLayer;" );
- pw.println( "import " + rootPackage + ".bootstrap.config.ConfigurationLayer;" );
- pw.println( "import " + rootPackage + ".bootstrap.infrastructure.InfrastructureLayer;" );
- pw.println();
- pw.print( "public class " );
- pw.print( projectName );
- pw.println( "ApplicationAssembler extends LayeredApplicationAssembler" );
- pw.println( "{" );
- pw.print( " private static final String NAME = \"" );
- pw.print( projectName );
- pw.println( "\";" );
- pw.println( " private static final String VERSION = \"1.0.alpha\";" );
- pw.println();
- pw.print(" public ");
- pw.print( projectName );
- pw.println("ApplicationAssembler( Application.Mode mode )");
- pw.println(" throws AssemblyException");
- pw.println(" {");
- pw.println(" super( NAME, VERSION, mode );");
- pw.println(" }");
- pw.println();
- pw.println(" @Override");
- pw.println(" protected void assembleLayers( ApplicationAssembly assembly )");
- pw.println(" throws AssemblyException");
- pw.println(" {");
- pw.println(" LayerAssembly configLayer = createLayer( ConfigurationLayer.class );");
- pw.println(" ModuleAssembly configModule = assemblerOf( ConfigurationLayer.class ).configModule();");
- pw.println(" LayerAssembly domainLayer = createLayer( DomainLayer.class );");
- pw.println(" Function<Application, Module> typeFinder = DomainLayer.typeFinder();");
- pw.println(" LayerAssembly infraLayer = new InfrastructureLayer( configModule, typeFinder ).assemble( assembly.layer( InfrastructureLayer.NAME ) );");
- pw.println(" LayerAssembly connectivityLayer = createLayer( ConnectivityLayer.class );");
- pw.println(" connectivityLayer.uses( domainLayer );");
- pw.println(" domainLayer.uses( infraLayer );");
- pw.println(" infraLayer.uses( configLayer );");
- pw.println(" }");
- pw.println("}");
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/";
- String classname = properties.get( "project.name" ) + "ApplicationAssembler";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ));
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConfigLayerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConfigLayerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConfigLayerWriter.java
deleted file mode 100644
index 5b64a4b..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConfigLayerWriter.java
+++ /dev/null
@@ -1,81 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class ConfigLayerWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.config;" );
- pw.println();
- pw.println(
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.LayerAssembler;\n" +
- "import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;\n" +
- "\n" +
- "public class ConfigurationLayer extends LayeredLayerAssembler\n" +
- " implements LayerAssembler\n" +
- "{\n" +
- " public static final String NAME = \"Configuration Layer\";\n" +
- " private ModuleAssembly configModule;\n" +
- "\n" +
- " @Override\n" +
- " public LayerAssembly assemble( LayerAssembly layer )\n" +
- " throws AssemblyException\n" +
- " {\n" +
- " configModule = createModule( layer, ConfigModule.class );\n" +
- " return layer;\n" +
- " }\n" +
- "\n" +
- " public ModuleAssembly configModule()\n" +
- " {\n" +
- " return configModule;\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/config/";
- String classname = "ConfigurationLayer";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConfigModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConfigModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConfigModuleWriter.java
deleted file mode 100644
index 7ac15a9..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConfigModuleWriter.java
+++ /dev/null
@@ -1,77 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class ConfigModuleWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.config;" );
- pw.println();
- pw.println(
- "import org.apache.zest.api.common.Visibility;\n" +
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
- "import org.apache.zest.entitystore.memory.MemoryEntityStoreService;\n" +
- "import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;\n" +
- "import org.apache.zest.valueserialization.jackson.JacksonValueSerializationAssembler;\n" +
- "\n" +
- "public class ConfigModule\n" +
- " implements ModuleAssembler\n" +
- "{\n" +
- " @Override\n" +
- " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
- " throws AssemblyException\n" +
- " {\n" +
- " module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.layer );\n" +
- " new JacksonValueSerializationAssembler().visibleIn( Visibility.layer ).assemble( module );\n" +
- " module.services( UuidIdentityGeneratorService.class ).visibleIn( Visibility.layer );\n" +
- " return module;\n" +
- " }\n" +
- "}\n");
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/config/";
- String classname = "ConfigModule";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConnectivityLayerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConnectivityLayerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConnectivityLayerWriter.java
deleted file mode 100644
index 2ae810c..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/ConnectivityLayerWriter.java
+++ /dev/null
@@ -1,74 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class ConnectivityLayerWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.connectivity;" );
- pw.println();
- pw.println(
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.LayerAssembler;\n" +
- "import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;\n" +
- "\n" +
- "public class ConnectivityLayer extends LayeredLayerAssembler\n" +
- " implements LayerAssembler\n" +
- "{\n" +
- " public static String NAME;\n" +
- "\n" +
- " @Override\n" +
- " public LayerAssembly assemble( LayerAssembly layer )\n" +
- " throws AssemblyException\n" +
- " {\n" +
- " createModule( layer, RestModule.class );\n" +
- " return layer;\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/connectivity/";
- String classname = "ConnectivityLayer";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/CrudModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/CrudModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/CrudModuleWriter.java
deleted file mode 100644
index df73ae3..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/CrudModuleWriter.java
+++ /dev/null
@@ -1,74 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class CrudModuleWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.domain;" );
- pw.println();
- pw.println(
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
- "import org.apache.zest.library.restlet.assembly.CrudServiceAssembler;\n" +
- "\n" +
- "public class CrudModule\n" +
- " implements ModuleAssembler\n" +
- "{\n" +
- " @Override\n" +
- " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
- " throws AssemblyException\n" +
- " {\n" +
- " module.withDefaultUnitOfWorkFactory();\n" +
- " new CrudServiceAssembler().assemble( module );\n" +
- " return module;\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/domain/";
- String classname = "CrudModule";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/CustomerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/CustomerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/CustomerWriter.java
deleted file mode 100644
index 65a325a..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/CustomerWriter.java
+++ /dev/null
@@ -1,68 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class CustomerWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".model.orders;" );
- pw.println();
- pw.println("import java.time.ZonedDateTime;");
- pw.println("import org.apache.zest.api.entity.Identity;");
- pw.println("import org.apache.zest.api.property.Property;");
- pw.println();
- pw.println(
- "public interface Customer extends Identity\n" +
- "{\n" +
- " Property<String> name();\n\n" +
- " Property<String> address();\n\n" +
- " Property<String> city();\n\n" +
- " Property<String> country();\n\n" +
- " Property<String> phone();\n\n" +
- " Property<ZonedDateTime> registered();\n\n" +
- "}\n");
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/model/orders/";
- String classname = "Customer";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "model/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/DomainLayerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/DomainLayerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/DomainLayerWriter.java
deleted file mode 100644
index 3c7b652..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/DomainLayerWriter.java
+++ /dev/null
@@ -1,82 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class DomainLayerWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.domain;" );
- pw.println();
- pw.println(
- "import java.util.function.Function;\n" +
- "import org.apache.zest.api.structure.Application;\n" +
- "import org.apache.zest.api.structure.Module;\n" +
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.LayerAssembler;\n" +
- "import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;\n" +
- "\n" +
- "public class DomainLayer extends LayeredLayerAssembler\n" +
- " implements LayerAssembler\n" +
- "{\n" +
- " @Override\n" +
- " public LayerAssembly assemble(LayerAssembly layer)\n" +
- " throws AssemblyException\n" +
- " {\n" +
- " createModule( layer, CrudModule.class );\n" +
- " createModule( layer, OrderModule.class ); // This is a simple sample that you typically remove.\n" +
- " createModule( layer, SecurityModule.class ); // This is a simple sample that you typically remove.\n" +
- " return layer;\n" +
- " }\n" +
- "\n" +
- " public static Function<Application, Module> typeFinder()\n" +
- " {\n" +
- " return application -> application.findModule( \"Domain Layer\", \"Assets Module\" );\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/domain/";
- String classname = "DomainLayer";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
[5/5] zest-java git commit: Forgotten to call the super.assemble() in
other serialization tests.
Posted by ni...@apache.org.
Forgotten to call the super.assemble() in other serialization tests.
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/0accd2cf
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/0accd2cf
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/0accd2cf
Branch: refs/heads/develop
Commit: 0accd2cf631dcba4065d6c71f6bb19f452af7693
Parents: 09facf1
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Sat Apr 16 13:38:14 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Sat Apr 16 13:38:15 2016 +0800
----------------------------------------------------------------------
.../org/apache/zest/api/structure/Module.java | 42 ++++-
.../zest/bootstrap/SingletonAssembler.java | 16 ++
.../zest/runtime/structure/ModuleInstance.java | 28 ++++
.../OrgJsonPlainValueSerializationTest.java | 3 +
.../stax/StaxPlainValueSerializationTest.java | 3 +
tools/shell/build.gradle | 5 +-
tools/shell/dev-status.xml | 38 +++++
.../templates/default/files/app/build.gradle_ | 20 +++
.../src/main/java/__package__/app/package.html | 23 +++
.../app/src/main/resources/___placeholder___ | 0
.../app/src/test/java/__package__/package.html | 21 +++
.../default/files/bootstrap/build.gradle_ | 16 ++
.../__package__/bootstrap/config/package.html_ | 1 +
.../bootstrap/connectivity/package.html_ | 1 +
.../__package__/bootstrap/domain/package.html_ | 1 +
.../bootstrap/infrastructure/package.html_ | 1 +
.../src/main/resources/___placeholder___ | 0
.../src/test/java/__package__/package.html_ | 1 +
.../etc/templates/default/files/build.gradle_ | 26 +++
.../files/gradle/wrapper/gradle-wrapper.jar_ | Bin 0 -> 51348 bytes
.../gradle/wrapper/gradle-wrapper.properties_ | 6 +
.../etc/templates/default/files/gradlew.bat_ | 90 ++++++++++
.../src/etc/templates/default/files/gradlew_ | 164 +++++++++++++++++++
.../templates/default/files/model/build.gradle_ | 7 +
.../java/__package__/model/orders/package.html_ | 1 +
.../__package__/model/security/package.html_ | 1 +
.../model/src/main/resources/___placeholder___ | 0
.../src/test/java/__package__/package.html_ | 1 +
.../src/etc/templates/null/files/build.gradle_ | 24 +++
.../files/gradle/wrapper/gradle-wrapper.jar_ | 0
.../gradle/wrapper/gradle-wrapper.properties_ | 6 +
.../src/etc/templates/null/files/gradlew.bat_ | 90 ++++++++++
.../shell/src/etc/templates/null/files/gradlew_ | 164 +++++++++++++++++++
.../src/main/java/__package__/package.html_ | 1 +
.../src/test/java/__package__/package.html_ | 1 +
.../templates/restapp/files/app/build.gradle_ | 20 +++
.../src/main/java/__package__/app/package.html | 23 +++
.../app/src/main/resources/___placeholder___ | 0
.../src/main/webapp/WEB-INF/___placeholder___ | 0
.../app/src/test/java/__package__/package.html | 21 +++
.../restapp/files/bootstrap/build.gradle_ | 16 ++
.../__package__/bootstrap/config/package.html_ | 1 +
.../bootstrap/connectivity/package.html_ | 1 +
.../__package__/bootstrap/domain/package.html_ | 1 +
.../bootstrap/infrastructure/package.html_ | 1 +
.../src/main/resources/___placeholder___ | 0
.../src/test/java/__package__/package.html_ | 1 +
.../etc/templates/restapp/files/build.gradle_ | 26 +++
.../files/gradle/wrapper/gradle-wrapper.jar_ | Bin 0 -> 51348 bytes
.../gradle/wrapper/gradle-wrapper.properties_ | 6 +
.../etc/templates/restapp/files/gradlew.bat_ | 90 ++++++++++
.../src/etc/templates/restapp/files/gradlew_ | 164 +++++++++++++++++++
.../templates/restapp/files/model/build.gradle_ | 7 +
.../java/__package__/model/orders/package.html_ | 1 +
.../__package__/model/security/package.html_ | 1 +
.../model/src/main/resources/___placeholder___ | 0
.../src/test/java/__package__/package.html_ | 1 +
.../templates/restapp/files/rest/build.gradle_ | 8 +
.../__package__/rest/security/package.html_ | 1 +
.../rest/src/main/resources/___placeholder___ | 0
.../src/test/java/__package__/package.html_ | 1 +
.../restproject/files/app/build.gradle_ | 20 ---
.../src/main/java/__package__/app/package.html | 23 ---
.../src/main/webapp/WEB-INF/___placeholder___ | 1 -
.../app/src/test/java/__package__/package.html | 21 ---
.../restproject/files/bootstrap/build.gradle_ | 16 --
.../__package__/bootstrap/config/package.html_ | 1 -
.../bootstrap/connectivity/package.html_ | 1 -
.../__package__/bootstrap/domain/package.html_ | 1 -
.../bootstrap/infrastructure/package.html_ | 1 -
.../src/test/java/__package__/package.html_ | 1 -
.../templates/restproject/files/build.gradle_ | 26 ---
.../files/gradle/wrapper/gradle-wrapper.jar_ | Bin 51348 -> 0 bytes
.../gradle/wrapper/gradle-wrapper.properties_ | 6 -
.../templates/restproject/files/gradlew.bat_ | 90 ----------
.../etc/templates/restproject/files/gradlew_ | 164 -------------------
.../restproject/files/model/build.gradle_ | 7 -
.../java/__package__/model/orders/package.html_ | 1 -
.../__package__/model/security/package.html_ | 1 -
.../src/test/java/__package__/package.html_ | 1 -
.../restproject/files/rest/build.gradle_ | 8 -
.../__package__/rest/security/package.html_ | 1 -
.../src/test/java/__package__/package.html_ | 1 -
.../etc/templates/singleton/files/build.gradle_ | 24 +++
.../files/gradle/wrapper/gradle-wrapper.jar_ | Bin 0 -> 51348 bytes
.../gradle/wrapper/gradle-wrapper.properties_ | 6 +
.../etc/templates/singleton/files/gradlew.bat_ | 90 ++++++++++
.../src/etc/templates/singleton/files/gradlew_ | 164 +++++++++++++++++++
.../src/main/java/__package__/package.html_ | 1 +
.../src/test/java/__package__/package.html_ | 1 +
.../org/apache/zest/tools/shell/FileUtils.java | 34 +++-
.../java/org/apache/zest/tools/shell/Main.java | 26 ++-
.../zest/tools/shell/create/CreateProject.java | 8 +-
.../create/project/DefaultProjectCreator.java | 79 +++++++++
.../create/project/NullProjectCreator.java | 37 +++++
.../create/project/RestAppProjectCreator.java | 88 ++++++++++
.../create/project/RestProjectCreator.java | 91 ----------
.../create/project/SingletonProjectCreator.java | 39 +++++
.../common/ApplicationAssemblerWriter.java | 105 ++++++++++++
.../project/common/ConfigLayerWriter.java | 81 +++++++++
.../project/common/ConfigModuleWriter.java | 77 +++++++++
.../project/common/ConnectivityLayerWriter.java | 74 +++++++++
.../create/project/common/CrudModuleWriter.java | 74 +++++++++
.../create/project/common/CustomerWriter.java | 68 ++++++++
.../project/common/DomainLayerWriter.java | 82 ++++++++++
.../common/FileConfigurationModuleWriter.java | 76 +++++++++
.../HardCodedSecurityRepositoryMixinWriter.java | 87 ++++++++++
.../project/common/IndexingModuleWriter.java | 86 ++++++++++
.../common/InfrastructureLayerWriter.java | 91 ++++++++++
.../create/project/common/OrderItemWriter.java | 66 ++++++++
.../project/common/OrderModuleWriter.java | 85 ++++++++++
.../create/project/common/OrderWriter.java | 71 ++++++++
.../project/common/SecurityModuleWriter.java | 88 ++++++++++
.../common/SecurityRepositoryWriter.java | 71 ++++++++
.../common/SerializationModuleWriter.java | 90 ++++++++++
.../create/project/common/SettingsWriter.java | 75 +++++++++
.../project/common/StorageModuleWriter.java | 87 ++++++++++
.../project/defaultp/ApplicationWriter.java | 106 ++++++++++++
.../restapp/ApplicationAssemblerWriter.java | 105 ------------
.../project/restapp/ConfigLayerWriter.java | 81 ---------
.../project/restapp/ConfigModuleWriter.java | 77 ---------
.../restapp/ConnectivityLayerWriter.java | 74 ---------
.../project/restapp/CrudModuleWriter.java | 74 ---------
.../create/project/restapp/CustomerWriter.java | 68 --------
.../project/restapp/DomainLayerWriter.java | 82 ----------
.../restapp/FileConfigurationModuleWriter.java | 76 ---------
.../HardCodedSecurityRepositoryMixinWriter.java | 87 ----------
.../project/restapp/IndexingModuleWriter.java | 86 ----------
.../restapp/InfrastructureLayerWriter.java | 91 ----------
.../create/project/restapp/OrderItemWriter.java | 66 --------
.../project/restapp/OrderModuleWriter.java | 85 ----------
.../create/project/restapp/OrderWriter.java | 71 --------
.../project/restapp/SecurityModuleWriter.java | 88 ----------
.../restapp/SecurityRepositoryWriter.java | 71 --------
.../restapp/SerializationModuleWriter.java | 90 ----------
.../create/project/restapp/SettingsWriter.java | 75 ---------
.../project/restapp/StorageModuleWriter.java | 87 ----------
.../SingletonApplicationAssemblerWriter.java | 105 ++++++++++++
.../project/singleton/StartupServiceWriter.java | 70 ++++++++
.../zest/tools/shell/help/HelpCommand.java | 2 +-
.../templates/default/project.properties | 4 +
.../resources/templates/null/project.properties | 25 +++
.../templates/restapp/project.properties | 4 +-
.../templates/singleton/project.properties | 24 +++
.../apache/zest/tools/shell/FileUtilsTest.java | 106 ++++++++++++
.../tools/shell/HelpNeededExceptionTest.java | 32 ++++
.../org/apache/zest/tools/shell/TestHelper.java | 41 +++++
.../tools/shell/create/CreateProjectTest.java | 69 ++++++++
.../project/DefaultProjectCreatorTest.java | 108 ++++++++++++
.../create/project/NullProjectCreatorTest.java | 66 ++++++++
.../project/RestappProjectCreatorTest.java | 119 ++++++++++++++
151 files changed, 4175 insertions(+), 2047 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/core/api/src/main/java/org/apache/zest/api/structure/Module.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/structure/Module.java b/core/api/src/main/java/org/apache/zest/api/structure/Module.java
index b3e262a..073ffa1 100644
--- a/core/api/src/main/java/org/apache/zest/api/structure/Module.java
+++ b/core/api/src/main/java/org/apache/zest/api/structure/Module.java
@@ -19,21 +19,14 @@
*/
package org.apache.zest.api.structure;
-import java.util.stream.Stream;
import org.apache.zest.api.activation.ActivationEventListenerRegistration;
import org.apache.zest.api.composite.TransientBuilderFactory;
-import org.apache.zest.api.composite.TransientDescriptor;
-import org.apache.zest.api.entity.EntityDescriptor;
import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.object.ObjectDescriptor;
import org.apache.zest.api.object.ObjectFactory;
import org.apache.zest.api.query.QueryBuilderFactory;
-import org.apache.zest.api.service.ImportedServiceDescriptor;
-import org.apache.zest.api.service.ServiceDescriptor;
import org.apache.zest.api.service.ServiceFinder;
import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.api.value.ValueDescriptor;
/**
* API for interacting with a Module. Instances
@@ -58,13 +51,44 @@ public interface Module
ModuleDescriptor descriptor();
/**
- *
* @return the Layer that the Module is declared in.
*/
LayerDescriptor layer();
+ /** Returns the TypeLookup for the Module.
+ * TypeLookup handles all the types visible from within this Module.
+ *
+ * @return TypeLookup for this Module
+ */
+ TypeLookup typeLookup();
+ /** Returns the UnitOfWorkFactory for this Module.
+ *
+ * @return the UnitOfWorkFactory of this Module.
+ */
UnitOfWorkFactory unitOfWorkFactory();
- TypeLookup typeLookup();
+ /** Returns the ServiceFinder for this Module.
+ *
+ * @return the ServiceFinder for this Module.
+ */
+ ServiceFinder serviceFinder();
+
+ /** Returns the ValueBuilderFactory for this Module.
+ *
+ * @return the ValueBuilderFactory for this Module.
+ */
+ ValueBuilderFactory valueBuilderFactory();
+
+ /** Returns the TransientBuilderFactory for this Module.
+ *
+ * @return the TransientBuilderFactory for this Module.
+ */
+ TransientBuilderFactory transientBuilderFactory();
+
+ /** Returns the ObjectFactory for this Module.
+ *
+ * @return the ObjectFactory for this Module.
+ */
+ ObjectFactory objectFactory();
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/core/bootstrap/src/main/java/org/apache/zest/bootstrap/SingletonAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/SingletonAssembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/SingletonAssembler.java
index b97457c..c0fd47c 100644
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/SingletonAssembler.java
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/SingletonAssembler.java
@@ -22,8 +22,13 @@ package org.apache.zest.bootstrap;
import org.apache.zest.api.ZestAPI;
import org.apache.zest.api.activation.ActivationException;
+import org.apache.zest.api.composite.TransientBuilderFactory;
+import org.apache.zest.api.object.ObjectFactory;
+import org.apache.zest.api.service.ServiceFinder;
import org.apache.zest.api.structure.Application;
import org.apache.zest.api.structure.Module;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
+import org.apache.zest.api.value.ValueBuilderFactory;
/**
* Base class for Assembler that creates an Application
@@ -36,6 +41,12 @@ import org.apache.zest.api.structure.Module;
public abstract class SingletonAssembler
implements Assembler
{
+ private final UnitOfWorkFactory unitOfWorkFactory;
+ private final ServiceFinder serviceFinder;
+ private final ValueBuilderFactory valueBuilderFactory;
+ private final TransientBuilderFactory transientBuilderFactory;
+ private final ObjectFactory objectFactory;
+
private Energy4Java zest;
private Application applicationInstance;
private final Module moduleInstance;
@@ -81,6 +92,11 @@ public abstract class SingletonAssembler
// START SNIPPET: actual
moduleInstance = applicationInstance.findModule( "Layer 1", "Module 1" );
+ unitOfWorkFactory = moduleInstance.unitOfWorkFactory();
+ serviceFinder = moduleInstance.serviceFinder();
+ valueBuilderFactory = moduleInstance.valueBuilderFactory();
+ transientBuilderFactory = moduleInstance.transientBuilderFactory();
+ objectFactory = moduleInstance.objectFactory();
}
public final ZestAPI runtime()
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java
index 9cc74fd..b9858c8 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java
@@ -40,17 +40,20 @@ import org.apache.zest.api.composite.Composite;
import org.apache.zest.api.composite.ModelDescriptor;
import org.apache.zest.api.composite.NoSuchTransientException;
import org.apache.zest.api.composite.TransientBuilder;
+import org.apache.zest.api.composite.TransientBuilderFactory;
import org.apache.zest.api.composite.TransientDescriptor;
import org.apache.zest.api.entity.EntityReference;
import org.apache.zest.api.entity.IdentityGenerator;
import org.apache.zest.api.metrics.MetricsProvider;
import org.apache.zest.api.object.NoSuchObjectException;
import org.apache.zest.api.object.ObjectDescriptor;
+import org.apache.zest.api.object.ObjectFactory;
import org.apache.zest.api.property.Property;
import org.apache.zest.api.property.PropertyDescriptor;
import org.apache.zest.api.query.QueryBuilder;
import org.apache.zest.api.query.QueryBuilderFactory;
import org.apache.zest.api.service.NoSuchServiceException;
+import org.apache.zest.api.service.ServiceFinder;
import org.apache.zest.api.service.ServiceReference;
import org.apache.zest.api.structure.LayerDescriptor;
import org.apache.zest.api.structure.Module;
@@ -61,6 +64,7 @@ import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
import org.apache.zest.api.util.NullArgumentException;
import org.apache.zest.api.value.NoSuchValueException;
import org.apache.zest.api.value.ValueBuilder;
+import org.apache.zest.api.value.ValueBuilderFactory;
import org.apache.zest.api.value.ValueComposite;
import org.apache.zest.api.value.ValueDescriptor;
import org.apache.zest.api.value.ValueSerialization;
@@ -501,6 +505,30 @@ public class ModuleInstance
return uowf;
}
+ @Override
+ public ServiceFinder serviceFinder()
+ {
+ return this;
+ }
+
+ @Override
+ public ValueBuilderFactory valueBuilderFactory()
+ {
+ return this;
+ }
+
+ @Override
+ public TransientBuilderFactory transientBuilderFactory()
+ {
+ return this;
+ }
+
+ @Override
+ public ObjectFactory objectFactory()
+ {
+ return this;
+ }
+
public IdentityGenerator identityGenerator()
{
synchronized( this )
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/extensions/valueserialization-orgjson/src/test/java/org/apache/zest/valueserialization/orgjson/OrgJsonPlainValueSerializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-orgjson/src/test/java/org/apache/zest/valueserialization/orgjson/OrgJsonPlainValueSerializationTest.java b/extensions/valueserialization-orgjson/src/test/java/org/apache/zest/valueserialization/orgjson/OrgJsonPlainValueSerializationTest.java
index 85cff40..6357e7a 100644
--- a/extensions/valueserialization-orgjson/src/test/java/org/apache/zest/valueserialization/orgjson/OrgJsonPlainValueSerializationTest.java
+++ b/extensions/valueserialization-orgjson/src/test/java/org/apache/zest/valueserialization/orgjson/OrgJsonPlainValueSerializationTest.java
@@ -33,6 +33,9 @@ public class OrgJsonPlainValueSerializationTest
throws AssemblyException
{
new OrgJsonValueSerializationAssembler().assemble( module );
+ // END SNIPPET: assembly
+ super.assemble( module );
+ // START SNIPPET: assembly
}
// END SNIPPET: assembly
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/extensions/valueserialization-stax/src/test/java/org/apache/zest/valueserialization/stax/StaxPlainValueSerializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-stax/src/test/java/org/apache/zest/valueserialization/stax/StaxPlainValueSerializationTest.java b/extensions/valueserialization-stax/src/test/java/org/apache/zest/valueserialization/stax/StaxPlainValueSerializationTest.java
index 9f3179d..adb1042 100644
--- a/extensions/valueserialization-stax/src/test/java/org/apache/zest/valueserialization/stax/StaxPlainValueSerializationTest.java
+++ b/extensions/valueserialization-stax/src/test/java/org/apache/zest/valueserialization/stax/StaxPlainValueSerializationTest.java
@@ -42,6 +42,9 @@ public class StaxPlainValueSerializationTest
throws AssemblyException
{
new StaxValueSerializationAssembler().assemble( module );
+ // END SNIPPET: assembly
+ super.assemble( module );
+ // START SNIPPET: assembly
}
// END SNIPPET: assembly
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/build.gradle
----------------------------------------------------------------------
diff --git a/tools/shell/build.gradle b/tools/shell/build.gradle
index b4ea20e..212929a 100644
--- a/tools/shell/build.gradle
+++ b/tools/shell/build.gradle
@@ -26,7 +26,8 @@ mainClassName = "org.apache.zest.tools.shell.Main"
jar { manifest { name = "Apache Zestâ„¢ Command Line" } }
dependencies {
- compile( project( ":org.apache.zest.core:org.apache.zest.core.bootstrap" ) )
+ compile project( ":org.apache.zest.core:org.apache.zest.core.bootstrap" )
- testRuntime( libraries.logback )
+ testCompile libraries.junit
+ testRuntime libraries.logback
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/dev-status.xml
----------------------------------------------------------------------
diff --git a/tools/shell/dev-status.xml b/tools/shell/dev-status.xml
new file mode 100644
index 0000000..ea9c2e8
--- /dev/null
+++ b/tools/shell/dev-status.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ ~ 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.
+ ~
+ ~
+ -->
+<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
+ http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+ <status>
+ <!--none,early,beta,stable,mature-->
+ <codebase>beta</codebase>
+
+ <!-- none, brief, good, complete -->
+ <documentation>none</documentation>
+
+ <!-- none, some, good, complete -->
+ <unittests>none</unittests>
+ </status>
+ <licenses>
+ <license>ALv2</license>
+ </licenses>
+</module>
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/app/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/app/build.gradle_ b/tools/shell/src/etc/templates/default/files/app/build.gradle_
new file mode 100644
index 0000000..5a19653
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/app/build.gradle_
@@ -0,0 +1,20 @@
+
+apply plugin: 'war'
+apply plugin: 'jetty'
+
+dependencies {
+ compile project( ":bootstrap" )
+ compile project( ":model" )
+ compile project( ":rest" )
+
+ compile "org.apache.zest.core:org.apache.zest.core.spi:$zestVersion"
+ compile "org.apache.zest.core:org.apache.zest.core.bootstrap:$zestVersion"
+ compile "org.apache.zest.library:org.apache.zest.library.servlet:$zestVersion"
+
+ compile "javax.servlet:servlet-api:2.5"
+ compile "org.restlet.jee:org.restlet:2.3.4"
+
+ runtime "org.apache.zest.core:org.apache.zest.core.runtime:$zestVersion"
+ runtime "org.restlet.jee:org.restlet.ext.servlet:2.3.4"
+
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/app/src/main/java/__package__/app/package.html
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/app/src/main/java/__package__/app/package.html b/tools/shell/src/etc/templates/default/files/app/src/main/java/__package__/app/package.html
new file mode 100644
index 0000000..1f859fb
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/app/src/main/java/__package__/app/package.html
@@ -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.
+ ~
+ ~
+ -->
+
+<html>
+<body>This package contains the bootstrap code.</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/app/src/main/resources/___placeholder___
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/app/src/main/resources/___placeholder___ b/tools/shell/src/etc/templates/default/files/app/src/main/resources/___placeholder___
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/app/src/test/java/__package__/package.html
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/app/src/test/java/__package__/package.html b/tools/shell/src/etc/templates/default/files/app/src/test/java/__package__/package.html
new file mode 100644
index 0000000..8bb0a631
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/app/src/test/java/__package__/package.html
@@ -0,0 +1,21 @@
+<!--
+ ~ 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.
+ ~
+ ~
+ -->
+
+<html><body>Test directory</body></html>
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/bootstrap/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/bootstrap/build.gradle_ b/tools/shell/src/etc/templates/default/files/bootstrap/build.gradle_
new file mode 100644
index 0000000..f26f7f8
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/bootstrap/build.gradle_
@@ -0,0 +1,16 @@
+
+dependencies {
+ compile project( ":model" )
+ compile project( ":rest" )
+
+ compile "org.apache.zest.core:org.apache.zest.core.spi:$zestVersion"
+ compile "org.apache.zest.core:org.apache.zest.core.bootstrap:$zestVersion"
+
+
+ compile "org.apache.zest.library:org.apache.zest.library.fileconfig:$zestVersion"
+ compile "org.apache.zest.library:org.apache.zest.library.restlet:$zestVersion"
+ compile "org.apache.zest.extension:org.apache.zest.extension.entitystore-file:$zestVersion"
+ compile "org.apache.zest.extension:org.apache.zest.extension.indexing-rdf:$zestVersion"
+ compile "org.apache.zest.extension:org.apache.zest.extension.valueserialization-jackson:$zestVersion"
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_ b/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_
new file mode 100644
index 0000000..e4bffa5
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_
@@ -0,0 +1 @@
+<html><body>This package contains the assembly information for the Config layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_ b/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_
new file mode 100644
index 0000000..21dbaa9
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_
@@ -0,0 +1 @@
+<html><body>This package contains the assembly information for the Connectivity layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_ b/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_
new file mode 100644
index 0000000..2bdc426
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_
@@ -0,0 +1 @@
+<html><body>This package contains the assembly information for the Domain layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_ b/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_
new file mode 100644
index 0000000..cf2f9b5
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_
@@ -0,0 +1 @@
+<html><body>This package contains the assembly information for the Infrastructure layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/bootstrap/src/main/resources/___placeholder___
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/bootstrap/src/main/resources/___placeholder___ b/tools/shell/src/etc/templates/default/files/bootstrap/src/main/resources/___placeholder___
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/bootstrap/src/test/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/bootstrap/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/default/files/bootstrap/src/test/java/__package__/package.html_
new file mode 100644
index 0000000..300838d
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/bootstrap/src/test/java/__package__/package.html_
@@ -0,0 +1 @@
+<html><body>Tests package</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/build.gradle_ b/tools/shell/src/etc/templates/default/files/build.gradle_
new file mode 100644
index 0000000..9bfbb1e
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/build.gradle_
@@ -0,0 +1,26 @@
+
+version = 1.0
+
+rootProject.ext {
+ // zestVersion = @@version@@
+ zestVersion = 0 // 0 only during dev & testing
+}
+
+allprojects() {
+ apply plugin: 'java'
+ apply plugin: 'idea'
+ apply plugin: 'maven'
+
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ maven { name 'restlet-repo'; url 'http://maven.restlet.org/' }
+ }
+
+
+ dependencies {
+ compile "org.apache.zest.core:org.apache.zest.core.api:$zestVersion"
+ testCompile "org.apache.zest.core:org.apache.zest.core.testsupport:$zestVersion"
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/gradle/wrapper/gradle-wrapper.jar_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/gradle/wrapper/gradle-wrapper.jar_ b/tools/shell/src/etc/templates/default/files/gradle/wrapper/gradle-wrapper.jar_
new file mode 100644
index 0000000..0087cd3
Binary files /dev/null and b/tools/shell/src/etc/templates/default/files/gradle/wrapper/gradle-wrapper.jar_ differ
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/gradle/wrapper/gradle-wrapper.properties_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/gradle/wrapper/gradle-wrapper.properties_ b/tools/shell/src/etc/templates/default/files/gradle/wrapper/gradle-wrapper.properties_
new file mode 100644
index 0000000..fafa8dd
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/gradle/wrapper/gradle-wrapper.properties_
@@ -0,0 +1,6 @@
+#Mon Jul 06 10:43:59 EEST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/gradlew.bat_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/gradlew.bat_ b/tools/shell/src/etc/templates/default/files/gradlew.bat_
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/gradlew.bat_
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/gradlew_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/gradlew_ b/tools/shell/src/etc/templates/default/files/gradlew_
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/gradlew_
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/model/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/model/build.gradle_ b/tools/shell/src/etc/templates/default/files/model/build.gradle_
new file mode 100644
index 0000000..83f55b2
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/model/build.gradle_
@@ -0,0 +1,7 @@
+
+
+dependencies {
+
+ compile "org.restlet.jee:org.restlet:2.3.4"
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/model/src/main/java/__package__/model/orders/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/model/src/main/java/__package__/model/orders/package.html_ b/tools/shell/src/etc/templates/default/files/model/src/main/java/__package__/model/orders/package.html_
new file mode 100644
index 0000000..441cb85
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/model/src/main/java/__package__/model/orders/package.html_
@@ -0,0 +1 @@
+<html><body>Very simple Domain Model to showcase the features of the Restlet library</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/model/src/main/java/__package__/model/security/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/model/src/main/java/__package__/model/security/package.html_ b/tools/shell/src/etc/templates/default/files/model/src/main/java/__package__/model/security/package.html_
new file mode 100644
index 0000000..bcf0ee4
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/model/src/main/java/__package__/model/security/package.html_
@@ -0,0 +1 @@
+<html><body>Very simple Security Model to showcase the features of the Restlet library</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/model/src/main/resources/___placeholder___
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/model/src/main/resources/___placeholder___ b/tools/shell/src/etc/templates/default/files/model/src/main/resources/___placeholder___
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/default/files/model/src/test/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/default/files/model/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/default/files/model/src/test/java/__package__/package.html_
new file mode 100644
index 0000000..300838d
--- /dev/null
+++ b/tools/shell/src/etc/templates/default/files/model/src/test/java/__package__/package.html_
@@ -0,0 +1 @@
+<html><body>Tests package</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/null/files/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/null/files/build.gradle_ b/tools/shell/src/etc/templates/null/files/build.gradle_
new file mode 100644
index 0000000..9da0e88
--- /dev/null
+++ b/tools/shell/src/etc/templates/null/files/build.gradle_
@@ -0,0 +1,24 @@
+
+version = 1.0
+
+rootProject.ext {
+ zestVersion = @@version@@
+}
+
+allprojects() {
+ apply plugin: 'java'
+ apply plugin: 'idea'
+ apply plugin: 'maven'
+
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ }
+
+
+ dependencies {
+ compile "org.apache.zest.core:org.apache.zest.core.api:$zestVersion"
+ testCompile "org.apache.zest.core:org.apache.zest.core.testsupport:$zestVersion"
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/null/files/gradle/wrapper/gradle-wrapper.jar_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/null/files/gradle/wrapper/gradle-wrapper.jar_ b/tools/shell/src/etc/templates/null/files/gradle/wrapper/gradle-wrapper.jar_
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/null/files/gradle/wrapper/gradle-wrapper.properties_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/null/files/gradle/wrapper/gradle-wrapper.properties_ b/tools/shell/src/etc/templates/null/files/gradle/wrapper/gradle-wrapper.properties_
new file mode 100644
index 0000000..fafa8dd
--- /dev/null
+++ b/tools/shell/src/etc/templates/null/files/gradle/wrapper/gradle-wrapper.properties_
@@ -0,0 +1,6 @@
+#Mon Jul 06 10:43:59 EEST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/null/files/gradlew.bat_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/null/files/gradlew.bat_ b/tools/shell/src/etc/templates/null/files/gradlew.bat_
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/tools/shell/src/etc/templates/null/files/gradlew.bat_
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/null/files/gradlew_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/null/files/gradlew_ b/tools/shell/src/etc/templates/null/files/gradlew_
new file mode 100644
index 0000000..91a7e26
--- /dev/null
+++ b/tools/shell/src/etc/templates/null/files/gradlew_
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/null/files/src/main/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/null/files/src/main/java/__package__/package.html_ b/tools/shell/src/etc/templates/null/files/src/main/java/__package__/package.html_
new file mode 100644
index 0000000..e071c79
--- /dev/null
+++ b/tools/shell/src/etc/templates/null/files/src/main/java/__package__/package.html_
@@ -0,0 +1 @@
+<html><body>Package for the Java source files</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/null/files/src/test/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/null/files/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/null/files/src/test/java/__package__/package.html_
new file mode 100644
index 0000000..eaefd36
--- /dev/null
+++ b/tools/shell/src/etc/templates/null/files/src/test/java/__package__/package.html_
@@ -0,0 +1 @@
+<html><body>Package for testing classes.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/app/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/app/build.gradle_ b/tools/shell/src/etc/templates/restapp/files/app/build.gradle_
new file mode 100644
index 0000000..5a19653
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/app/build.gradle_
@@ -0,0 +1,20 @@
+
+apply plugin: 'war'
+apply plugin: 'jetty'
+
+dependencies {
+ compile project( ":bootstrap" )
+ compile project( ":model" )
+ compile project( ":rest" )
+
+ compile "org.apache.zest.core:org.apache.zest.core.spi:$zestVersion"
+ compile "org.apache.zest.core:org.apache.zest.core.bootstrap:$zestVersion"
+ compile "org.apache.zest.library:org.apache.zest.library.servlet:$zestVersion"
+
+ compile "javax.servlet:servlet-api:2.5"
+ compile "org.restlet.jee:org.restlet:2.3.4"
+
+ runtime "org.apache.zest.core:org.apache.zest.core.runtime:$zestVersion"
+ runtime "org.restlet.jee:org.restlet.ext.servlet:2.3.4"
+
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/app/src/main/java/__package__/app/package.html
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/app/src/main/java/__package__/app/package.html b/tools/shell/src/etc/templates/restapp/files/app/src/main/java/__package__/app/package.html
new file mode 100644
index 0000000..1f859fb
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/app/src/main/java/__package__/app/package.html
@@ -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.
+ ~
+ ~
+ -->
+
+<html>
+<body>This package contains the bootstrap code.</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/app/src/main/resources/___placeholder___
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/app/src/main/resources/___placeholder___ b/tools/shell/src/etc/templates/restapp/files/app/src/main/resources/___placeholder___
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/app/src/main/webapp/WEB-INF/___placeholder___
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/app/src/main/webapp/WEB-INF/___placeholder___ b/tools/shell/src/etc/templates/restapp/files/app/src/main/webapp/WEB-INF/___placeholder___
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/app/src/test/java/__package__/package.html
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/app/src/test/java/__package__/package.html b/tools/shell/src/etc/templates/restapp/files/app/src/test/java/__package__/package.html
new file mode 100644
index 0000000..8bb0a631
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/app/src/test/java/__package__/package.html
@@ -0,0 +1,21 @@
+<!--
+ ~ 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.
+ ~
+ ~
+ -->
+
+<html><body>Test directory</body></html>
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/bootstrap/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/bootstrap/build.gradle_ b/tools/shell/src/etc/templates/restapp/files/bootstrap/build.gradle_
new file mode 100644
index 0000000..f26f7f8
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/bootstrap/build.gradle_
@@ -0,0 +1,16 @@
+
+dependencies {
+ compile project( ":model" )
+ compile project( ":rest" )
+
+ compile "org.apache.zest.core:org.apache.zest.core.spi:$zestVersion"
+ compile "org.apache.zest.core:org.apache.zest.core.bootstrap:$zestVersion"
+
+
+ compile "org.apache.zest.library:org.apache.zest.library.fileconfig:$zestVersion"
+ compile "org.apache.zest.library:org.apache.zest.library.restlet:$zestVersion"
+ compile "org.apache.zest.extension:org.apache.zest.extension.entitystore-file:$zestVersion"
+ compile "org.apache.zest.extension:org.apache.zest.extension.indexing-rdf:$zestVersion"
+ compile "org.apache.zest.extension:org.apache.zest.extension.valueserialization-jackson:$zestVersion"
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_ b/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_
new file mode 100644
index 0000000..e4bffa5
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_
@@ -0,0 +1 @@
+<html><body>This package contains the assembly information for the Config layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_ b/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_
new file mode 100644
index 0000000..21dbaa9
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_
@@ -0,0 +1 @@
+<html><body>This package contains the assembly information for the Connectivity layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_ b/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_
new file mode 100644
index 0000000..2bdc426
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_
@@ -0,0 +1 @@
+<html><body>This package contains the assembly information for the Domain layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_ b/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_
new file mode 100644
index 0000000..cf2f9b5
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_
@@ -0,0 +1 @@
+<html><body>This package contains the assembly information for the Infrastructure layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/resources/___placeholder___
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/resources/___placeholder___ b/tools/shell/src/etc/templates/restapp/files/bootstrap/src/main/resources/___placeholder___
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/bootstrap/src/test/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/bootstrap/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/restapp/files/bootstrap/src/test/java/__package__/package.html_
new file mode 100644
index 0000000..300838d
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/bootstrap/src/test/java/__package__/package.html_
@@ -0,0 +1 @@
+<html><body>Tests package</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/build.gradle_ b/tools/shell/src/etc/templates/restapp/files/build.gradle_
new file mode 100644
index 0000000..9bfbb1e
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/build.gradle_
@@ -0,0 +1,26 @@
+
+version = 1.0
+
+rootProject.ext {
+ // zestVersion = @@version@@
+ zestVersion = 0 // 0 only during dev & testing
+}
+
+allprojects() {
+ apply plugin: 'java'
+ apply plugin: 'idea'
+ apply plugin: 'maven'
+
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ maven { name 'restlet-repo'; url 'http://maven.restlet.org/' }
+ }
+
+
+ dependencies {
+ compile "org.apache.zest.core:org.apache.zest.core.api:$zestVersion"
+ testCompile "org.apache.zest.core:org.apache.zest.core.testsupport:$zestVersion"
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/gradle/wrapper/gradle-wrapper.jar_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/gradle/wrapper/gradle-wrapper.jar_ b/tools/shell/src/etc/templates/restapp/files/gradle/wrapper/gradle-wrapper.jar_
new file mode 100644
index 0000000..0087cd3
Binary files /dev/null and b/tools/shell/src/etc/templates/restapp/files/gradle/wrapper/gradle-wrapper.jar_ differ
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/gradle/wrapper/gradle-wrapper.properties_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/gradle/wrapper/gradle-wrapper.properties_ b/tools/shell/src/etc/templates/restapp/files/gradle/wrapper/gradle-wrapper.properties_
new file mode 100644
index 0000000..fafa8dd
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/gradle/wrapper/gradle-wrapper.properties_
@@ -0,0 +1,6 @@
+#Mon Jul 06 10:43:59 EEST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/gradlew.bat_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/gradlew.bat_ b/tools/shell/src/etc/templates/restapp/files/gradlew.bat_
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/gradlew.bat_
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/gradlew_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/gradlew_ b/tools/shell/src/etc/templates/restapp/files/gradlew_
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/gradlew_
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/model/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/model/build.gradle_ b/tools/shell/src/etc/templates/restapp/files/model/build.gradle_
new file mode 100644
index 0000000..83f55b2
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/model/build.gradle_
@@ -0,0 +1,7 @@
+
+
+dependencies {
+
+ compile "org.restlet.jee:org.restlet:2.3.4"
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/model/src/main/java/__package__/model/orders/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/model/src/main/java/__package__/model/orders/package.html_ b/tools/shell/src/etc/templates/restapp/files/model/src/main/java/__package__/model/orders/package.html_
new file mode 100644
index 0000000..441cb85
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/model/src/main/java/__package__/model/orders/package.html_
@@ -0,0 +1 @@
+<html><body>Very simple Domain Model to showcase the features of the Restlet library</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/model/src/main/java/__package__/model/security/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/model/src/main/java/__package__/model/security/package.html_ b/tools/shell/src/etc/templates/restapp/files/model/src/main/java/__package__/model/security/package.html_
new file mode 100644
index 0000000..bcf0ee4
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/model/src/main/java/__package__/model/security/package.html_
@@ -0,0 +1 @@
+<html><body>Very simple Security Model to showcase the features of the Restlet library</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/model/src/main/resources/___placeholder___
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/model/src/main/resources/___placeholder___ b/tools/shell/src/etc/templates/restapp/files/model/src/main/resources/___placeholder___
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/model/src/test/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/model/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/restapp/files/model/src/test/java/__package__/package.html_
new file mode 100644
index 0000000..300838d
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/model/src/test/java/__package__/package.html_
@@ -0,0 +1 @@
+<html><body>Tests package</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/rest/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/rest/build.gradle_ b/tools/shell/src/etc/templates/restapp/files/rest/build.gradle_
new file mode 100644
index 0000000..a89355a
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/rest/build.gradle_
@@ -0,0 +1,8 @@
+
+dependencies {
+ compile project( ":model" )
+
+ compile "org.apache.zest.core:org.apache.zest.core.api:$zestVersion"
+ compile "org.apache.zest.library:org.apache.zest.library.restlet:$zestVersion"
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/rest/src/main/java/__package__/rest/security/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/rest/src/main/java/__package__/rest/security/package.html_ b/tools/shell/src/etc/templates/restapp/files/rest/src/main/java/__package__/rest/security/package.html_
new file mode 100644
index 0000000..249f68c
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/rest/src/main/java/__package__/rest/security/package.html_
@@ -0,0 +1 @@
+<html><body>Package for the security handling in the Connectivity Layer</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/rest/src/main/resources/___placeholder___
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/rest/src/main/resources/___placeholder___ b/tools/shell/src/etc/templates/restapp/files/rest/src/main/resources/___placeholder___
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restapp/files/rest/src/test/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restapp/files/rest/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/restapp/files/rest/src/test/java/__package__/package.html_
new file mode 100644
index 0000000..300838d
--- /dev/null
+++ b/tools/shell/src/etc/templates/restapp/files/rest/src/test/java/__package__/package.html_
@@ -0,0 +1 @@
+<html><body>Tests package</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/app/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/app/build.gradle_ b/tools/shell/src/etc/templates/restproject/files/app/build.gradle_
deleted file mode 100644
index 5a19653..0000000
--- a/tools/shell/src/etc/templates/restproject/files/app/build.gradle_
+++ /dev/null
@@ -1,20 +0,0 @@
-
-apply plugin: 'war'
-apply plugin: 'jetty'
-
-dependencies {
- compile project( ":bootstrap" )
- compile project( ":model" )
- compile project( ":rest" )
-
- compile "org.apache.zest.core:org.apache.zest.core.spi:$zestVersion"
- compile "org.apache.zest.core:org.apache.zest.core.bootstrap:$zestVersion"
- compile "org.apache.zest.library:org.apache.zest.library.servlet:$zestVersion"
-
- compile "javax.servlet:servlet-api:2.5"
- compile "org.restlet.jee:org.restlet:2.3.4"
-
- runtime "org.apache.zest.core:org.apache.zest.core.runtime:$zestVersion"
- runtime "org.restlet.jee:org.restlet.ext.servlet:2.3.4"
-
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/app/src/main/java/__package__/app/package.html
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/app/src/main/java/__package__/app/package.html b/tools/shell/src/etc/templates/restproject/files/app/src/main/java/__package__/app/package.html
deleted file mode 100644
index 1f859fb..0000000
--- a/tools/shell/src/etc/templates/restproject/files/app/src/main/java/__package__/app/package.html
+++ /dev/null
@@ -1,23 +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.
- ~
- ~
- -->
-
-<html>
-<body>This package contains the bootstrap code.</body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/app/src/main/webapp/WEB-INF/___placeholder___
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/app/src/main/webapp/WEB-INF/___placeholder___ b/tools/shell/src/etc/templates/restproject/files/app/src/main/webapp/WEB-INF/___placeholder___
deleted file mode 100644
index 0e6b010..0000000
--- a/tools/shell/src/etc/templates/restproject/files/app/src/main/webapp/WEB-INF/___placeholder___
+++ /dev/null
@@ -1 +0,0 @@
-Webapp directory.
\ No newline at end of file
[4/5] zest-java git commit: Forgotten to call the super.assemble() in
other serialization tests.
Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/app/src/test/java/__package__/package.html
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/app/src/test/java/__package__/package.html b/tools/shell/src/etc/templates/restproject/files/app/src/test/java/__package__/package.html
deleted file mode 100644
index 8bb0a631..0000000
--- a/tools/shell/src/etc/templates/restproject/files/app/src/test/java/__package__/package.html
+++ /dev/null
@@ -1,21 +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.
- ~
- ~
- -->
-
-<html><body>Test directory</body></html>
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/build.gradle_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/build.gradle_
deleted file mode 100644
index f26f7f8..0000000
--- a/tools/shell/src/etc/templates/restproject/files/bootstrap/build.gradle_
+++ /dev/null
@@ -1,16 +0,0 @@
-
-dependencies {
- compile project( ":model" )
- compile project( ":rest" )
-
- compile "org.apache.zest.core:org.apache.zest.core.spi:$zestVersion"
- compile "org.apache.zest.core:org.apache.zest.core.bootstrap:$zestVersion"
-
-
- compile "org.apache.zest.library:org.apache.zest.library.fileconfig:$zestVersion"
- compile "org.apache.zest.library:org.apache.zest.library.restlet:$zestVersion"
- compile "org.apache.zest.extension:org.apache.zest.extension.entitystore-file:$zestVersion"
- compile "org.apache.zest.extension:org.apache.zest.extension.indexing-rdf:$zestVersion"
- compile "org.apache.zest.extension:org.apache.zest.extension.valueserialization-jackson:$zestVersion"
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_
deleted file mode 100644
index e4bffa5..0000000
--- a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_
+++ /dev/null
@@ -1 +0,0 @@
-<html><body>This package contains the assembly information for the Config layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_
deleted file mode 100644
index 21dbaa9..0000000
--- a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_
+++ /dev/null
@@ -1 +0,0 @@
-<html><body>This package contains the assembly information for the Connectivity layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_
deleted file mode 100644
index 2bdc426..0000000
--- a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_
+++ /dev/null
@@ -1 +0,0 @@
-<html><body>This package contains the assembly information for the Domain layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_
deleted file mode 100644
index cf2f9b5..0000000
--- a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_
+++ /dev/null
@@ -1 +0,0 @@
-<html><body>This package contains the assembly information for the Infrastructure layer.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/src/test/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/src/test/java/__package__/package.html_
deleted file mode 100644
index 300838d..0000000
--- a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/test/java/__package__/package.html_
+++ /dev/null
@@ -1 +0,0 @@
-<html><body>Tests package</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/build.gradle_ b/tools/shell/src/etc/templates/restproject/files/build.gradle_
deleted file mode 100644
index 9bfbb1e..0000000
--- a/tools/shell/src/etc/templates/restproject/files/build.gradle_
+++ /dev/null
@@ -1,26 +0,0 @@
-
-version = 1.0
-
-rootProject.ext {
- // zestVersion = @@version@@
- zestVersion = 0 // 0 only during dev & testing
-}
-
-allprojects() {
- apply plugin: 'java'
- apply plugin: 'idea'
- apply plugin: 'maven'
-
- repositories {
- mavenLocal()
- mavenCentral()
- maven { name 'restlet-repo'; url 'http://maven.restlet.org/' }
- }
-
-
- dependencies {
- compile "org.apache.zest.core:org.apache.zest.core.api:$zestVersion"
- testCompile "org.apache.zest.core:org.apache.zest.core.testsupport:$zestVersion"
- }
-}
-
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.jar_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.jar_ b/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.jar_
deleted file mode 100644
index 0087cd3..0000000
Binary files a/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.jar_ and /dev/null differ
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.properties_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.properties_ b/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.properties_
deleted file mode 100644
index fafa8dd..0000000
--- a/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.properties_
+++ /dev/null
@@ -1,6 +0,0 @@
-#Mon Jul 06 10:43:59 EEST 2015
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/gradlew.bat_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/gradlew.bat_ b/tools/shell/src/etc/templates/restproject/files/gradlew.bat_
deleted file mode 100644
index 8a0b282..0000000
--- a/tools/shell/src/etc/templates/restproject/files/gradlew.bat_
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/gradlew_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/gradlew_ b/tools/shell/src/etc/templates/restproject/files/gradlew_
deleted file mode 100755
index 91a7e26..0000000
--- a/tools/shell/src/etc/templates/restproject/files/gradlew_
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/model/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/model/build.gradle_ b/tools/shell/src/etc/templates/restproject/files/model/build.gradle_
deleted file mode 100644
index 83f55b2..0000000
--- a/tools/shell/src/etc/templates/restproject/files/model/build.gradle_
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-dependencies {
-
- compile "org.restlet.jee:org.restlet:2.3.4"
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/orders/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/orders/package.html_ b/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/orders/package.html_
deleted file mode 100644
index 441cb85..0000000
--- a/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/orders/package.html_
+++ /dev/null
@@ -1 +0,0 @@
-<html><body>Very simple Domain Model to showcase the features of the Restlet library</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/security/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/security/package.html_ b/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/security/package.html_
deleted file mode 100644
index bcf0ee4..0000000
--- a/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/security/package.html_
+++ /dev/null
@@ -1 +0,0 @@
-<html><body>Very simple Security Model to showcase the features of the Restlet library</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/model/src/test/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/model/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/restproject/files/model/src/test/java/__package__/package.html_
deleted file mode 100644
index 300838d..0000000
--- a/tools/shell/src/etc/templates/restproject/files/model/src/test/java/__package__/package.html_
+++ /dev/null
@@ -1 +0,0 @@
-<html><body>Tests package</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/rest/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/rest/build.gradle_ b/tools/shell/src/etc/templates/restproject/files/rest/build.gradle_
deleted file mode 100644
index a89355a..0000000
--- a/tools/shell/src/etc/templates/restproject/files/rest/build.gradle_
+++ /dev/null
@@ -1,8 +0,0 @@
-
-dependencies {
- compile project( ":model" )
-
- compile "org.apache.zest.core:org.apache.zest.core.api:$zestVersion"
- compile "org.apache.zest.library:org.apache.zest.library.restlet:$zestVersion"
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/rest/src/main/java/__package__/rest/security/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/rest/src/main/java/__package__/rest/security/package.html_ b/tools/shell/src/etc/templates/restproject/files/rest/src/main/java/__package__/rest/security/package.html_
deleted file mode 100644
index 249f68c..0000000
--- a/tools/shell/src/etc/templates/restproject/files/rest/src/main/java/__package__/rest/security/package.html_
+++ /dev/null
@@ -1 +0,0 @@
-<html><body>Package for the security handling in the Connectivity Layer</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/rest/src/test/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/restproject/files/rest/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/restproject/files/rest/src/test/java/__package__/package.html_
deleted file mode 100644
index 300838d..0000000
--- a/tools/shell/src/etc/templates/restproject/files/rest/src/test/java/__package__/package.html_
+++ /dev/null
@@ -1 +0,0 @@
-<html><body>Tests package</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/singleton/files/build.gradle_ b/tools/shell/src/etc/templates/singleton/files/build.gradle_
new file mode 100644
index 0000000..9da0e88
--- /dev/null
+++ b/tools/shell/src/etc/templates/singleton/files/build.gradle_
@@ -0,0 +1,24 @@
+
+version = 1.0
+
+rootProject.ext {
+ zestVersion = @@version@@
+}
+
+allprojects() {
+ apply plugin: 'java'
+ apply plugin: 'idea'
+ apply plugin: 'maven'
+
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ }
+
+
+ dependencies {
+ compile "org.apache.zest.core:org.apache.zest.core.api:$zestVersion"
+ testCompile "org.apache.zest.core:org.apache.zest.core.testsupport:$zestVersion"
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.jar_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.jar_ b/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.jar_
new file mode 100644
index 0000000..0087cd3
Binary files /dev/null and b/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.jar_ differ
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.properties_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.properties_ b/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.properties_
new file mode 100644
index 0000000..fafa8dd
--- /dev/null
+++ b/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.properties_
@@ -0,0 +1,6 @@
+#Mon Jul 06 10:43:59 EEST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/gradlew.bat_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/singleton/files/gradlew.bat_ b/tools/shell/src/etc/templates/singleton/files/gradlew.bat_
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/tools/shell/src/etc/templates/singleton/files/gradlew.bat_
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/gradlew_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/singleton/files/gradlew_ b/tools/shell/src/etc/templates/singleton/files/gradlew_
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/tools/shell/src/etc/templates/singleton/files/gradlew_
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/src/main/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/singleton/files/src/main/java/__package__/package.html_ b/tools/shell/src/etc/templates/singleton/files/src/main/java/__package__/package.html_
new file mode 100644
index 0000000..e071c79
--- /dev/null
+++ b/tools/shell/src/etc/templates/singleton/files/src/main/java/__package__/package.html_
@@ -0,0 +1 @@
+<html><body>Package for the Java source files</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/src/test/java/__package__/package.html_
----------------------------------------------------------------------
diff --git a/tools/shell/src/etc/templates/singleton/files/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/singleton/files/src/test/java/__package__/package.html_
new file mode 100644
index 0000000..eaefd36
--- /dev/null
+++ b/tools/shell/src/etc/templates/singleton/files/src/test/java/__package__/package.html_
@@ -0,0 +1 @@
+<html><body>Package for testing classes.</body></html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/FileUtils.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/FileUtils.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/FileUtils.java
index a086f6a..22f8a9d 100644
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/FileUtils.java
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/FileUtils.java
@@ -23,7 +23,6 @@ import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -44,6 +43,28 @@ public class FileUtils
return dir;
}
+ public static boolean removeDir( File dir )
+ {
+ File[] files = dir.listFiles();
+ boolean success = true;
+ if( files != null )
+ {
+ for( File f : files )
+ {
+ if( f.isDirectory() )
+ {
+ success = success && removeDir( f );
+ }
+ else
+ {
+ success = success && f.delete();
+ }
+ }
+ }
+ success = success && dir.delete();
+ return success;
+ }
+
public static Map<String, String> readPropertiesResource( String resourceName )
{
ClassLoader cl = FileUtils.class.getClassLoader();
@@ -77,11 +98,14 @@ public class FileUtils
public static void copyFile( File srcFile, File dest )
throws IOException
{
- byte[] buffer = new byte[100000];
- try(BufferedInputStream in = new BufferedInputStream( new FileInputStream(srcFile) )){
- try(BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( dest ) )){
+ byte[] buffer = new byte[ 100000 ];
+ try (BufferedInputStream in = new BufferedInputStream( new FileInputStream( srcFile ) ))
+ {
+ try (BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( dest ) ))
+ {
int bytes;
- while( (bytes = in.read( buffer )) != -1 ){
+ while( ( bytes = in.read( buffer ) ) != -1 )
+ {
out.write( buffer, 0, bytes );
}
out.flush();
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/Main.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/Main.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/Main.java
index 138c112..a5eeb6d 100644
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/Main.java
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/Main.java
@@ -60,20 +60,32 @@ public class Main
}
else
{
- Command command = commands.get( args[ 0 ] );
- if( command == null )
+ try
{
- System.err.println( "Command " + args[ 0 ] + " is unknown." );
- System.err.println( "" );
- commands.get( "help" ).execute( args, input(), error() );
+ executeCommand( args );
}
- else
+ catch( HelpNeededException e )
{
- command.execute( args, input(), output() );
+ commands.get( "help" ).execute( args, input(), error() );
}
}
}
+ private void executeCommand( String[] args )
+ {
+ Command command = commands.get( args[ 0 ] );
+ if( command == null )
+ {
+ System.err.println( "Command " + args[ 0 ] + " is unknown." );
+ System.err.println( "" );
+ commands.get( "help" ).execute( args, input(), error() );
+ }
+ else
+ {
+ command.execute( args, input(), output() );
+ }
+ }
+
private boolean contains( String[] args, String s )
{
for( String arg : args )
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/CreateProject.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/CreateProject.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/CreateProject.java
index 8e724f7..15368c8 100644
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/CreateProject.java
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/CreateProject.java
@@ -35,7 +35,7 @@ public class CreateProject extends AbstractCommand
public void execute( String[] args, BufferedReader input, PrintWriter output )
throws HelpNeededException
{
- if( args.length < 4 )
+ if( args.length != 4 )
{
throw new HelpNeededException();
}
@@ -46,8 +46,8 @@ public class CreateProject extends AbstractCommand
Map<String, String> props = FileUtils.readPropertiesResource( "templates/" + template + "/project.properties" );
if( props == null )
{
- System.err.println( "Project Template " + template + " does not exist. " );
- System.exit( 1 );
+ System.err.println( "Project Template " + template + " does not exist. \n\n" );
+ throw new HelpNeededException();
}
props.put( "project.dir", projectDir.getAbsolutePath() );
props.put( "project.name", projectName);
@@ -70,7 +70,7 @@ public class CreateProject extends AbstractCommand
@Override
public String description()
{
- return "create project";
+ return "type name package\tCreates a new skeletal project in directory [name].";
}
@Override
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreator.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreator.java
new file mode 100644
index 0000000..7139475
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreator.java
@@ -0,0 +1,79 @@
+/*
+ * 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.zest.tools.shell.create.project;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import org.apache.zest.tools.shell.create.project.common.ApplicationAssemblerWriter;
+import org.apache.zest.tools.shell.create.project.common.ConfigLayerWriter;
+import org.apache.zest.tools.shell.create.project.common.ConfigModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.ConnectivityLayerWriter;
+import org.apache.zest.tools.shell.create.project.common.CrudModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.CustomerWriter;
+import org.apache.zest.tools.shell.create.project.common.DomainLayerWriter;
+import org.apache.zest.tools.shell.create.project.common.FileConfigurationModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.HardCodedSecurityRepositoryMixinWriter;
+import org.apache.zest.tools.shell.create.project.common.IndexingModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.InfrastructureLayerWriter;
+import org.apache.zest.tools.shell.create.project.common.OrderItemWriter;
+import org.apache.zest.tools.shell.create.project.common.OrderModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.OrderWriter;
+import org.apache.zest.tools.shell.create.project.common.SecurityModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.SecurityRepositoryWriter;
+import org.apache.zest.tools.shell.create.project.common.SerializationModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.SettingsWriter;
+import org.apache.zest.tools.shell.create.project.common.StorageModuleWriter;
+import org.apache.zest.tools.shell.create.project.defaultp.ApplicationWriter;
+
+public class DefaultProjectCreator extends AbstractProjectCreator
+ implements ProjectCreator
+{
+
+ @Override
+ public void create( String projectName, File projectDir, Map<String, String> properties )
+ throws IOException
+ {
+ super.create( projectName, projectDir, properties ); // creates the directory structures.
+ new ApplicationAssemblerWriter().writeClass( properties );
+ new ApplicationWriter().writeClass( properties );
+ new ConfigLayerWriter().writeClass( properties );
+ new ConfigModuleWriter().writeClass( properties );
+ new InfrastructureLayerWriter().writeClass( properties );
+ new FileConfigurationModuleWriter().writeClass( properties );
+ new StorageModuleWriter().writeClass( properties );
+ new IndexingModuleWriter().writeClass( properties );
+ new SerializationModuleWriter().writeClass( properties );
+ new DomainLayerWriter().writeClass( properties );
+ new OrderModuleWriter().writeClass( properties );
+ new CrudModuleWriter().writeClass( properties );
+ new ConnectivityLayerWriter().writeClass( properties );
+
+ new SecurityModuleWriter().writeClass( properties );
+ new SecurityRepositoryWriter().writeClass( properties );
+ new HardCodedSecurityRepositoryMixinWriter().writeClass( properties );
+ new OrderWriter().writeClass( properties );
+ new OrderItemWriter().writeClass( properties );
+ new CustomerWriter().writeClass( properties );
+
+ new SettingsWriter().writeClass( properties );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/NullProjectCreator.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/NullProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/NullProjectCreator.java
new file mode 100644
index 0000000..9e915b1
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/NullProjectCreator.java
@@ -0,0 +1,37 @@
+/*
+ * 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.zest.tools.shell.create.project;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+public class NullProjectCreator extends AbstractProjectCreator
+ implements ProjectCreator
+{
+
+ @Override
+ public void create( String projectName, File projectDir, Map<String, String> properties )
+ throws IOException
+ {
+ super.create( projectName, projectDir, properties ); // creates the directory structures.
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestAppProjectCreator.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestAppProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestAppProjectCreator.java
new file mode 100644
index 0000000..299305b
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestAppProjectCreator.java
@@ -0,0 +1,88 @@
+/*
+ * 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.zest.tools.shell.create.project;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import org.apache.zest.tools.shell.create.project.common.ApplicationAssemblerWriter;
+import org.apache.zest.tools.shell.create.project.restapp.ApplicationWriter;
+import org.apache.zest.tools.shell.create.project.common.ConfigLayerWriter;
+import org.apache.zest.tools.shell.create.project.common.ConfigModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.ConnectivityLayerWriter;
+import org.apache.zest.tools.shell.create.project.common.CrudModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.CustomerWriter;
+import org.apache.zest.tools.shell.create.project.common.DomainLayerWriter;
+import org.apache.zest.tools.shell.create.project.common.FileConfigurationModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.HardCodedSecurityRepositoryMixinWriter;
+import org.apache.zest.tools.shell.create.project.common.IndexingModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.InfrastructureLayerWriter;
+import org.apache.zest.tools.shell.create.project.common.OrderItemWriter;
+import org.apache.zest.tools.shell.create.project.common.OrderWriter;
+import org.apache.zest.tools.shell.create.project.restapp.RestModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.OrderModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.SecurityModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.SecurityRepositoryWriter;
+import org.apache.zest.tools.shell.create.project.common.SerializationModuleWriter;
+import org.apache.zest.tools.shell.create.project.common.SettingsWriter;
+import org.apache.zest.tools.shell.create.project.restapp.SimpleEnrolerWriter;
+import org.apache.zest.tools.shell.create.project.restapp.SimpleVerifierWriter;
+import org.apache.zest.tools.shell.create.project.common.StorageModuleWriter;
+import org.apache.zest.tools.shell.create.project.restapp.WebXmlWriter;
+
+public class RestAppProjectCreator extends AbstractProjectCreator
+ implements ProjectCreator
+{
+
+ @Override
+ public void create( String projectName, File projectDir, Map<String, String> properties )
+ throws IOException
+ {
+ super.create( projectName, projectDir, properties ); // creates the directory structures.
+ new ApplicationAssemblerWriter().writeClass( properties );
+ new ConfigLayerWriter().writeClass( properties );
+ new ConfigModuleWriter().writeClass( properties );
+ new InfrastructureLayerWriter().writeClass( properties );
+ new FileConfigurationModuleWriter().writeClass( properties );
+ new StorageModuleWriter().writeClass( properties );
+ new IndexingModuleWriter().writeClass( properties );
+ new SerializationModuleWriter().writeClass( properties );
+ new DomainLayerWriter().writeClass( properties );
+ new OrderModuleWriter().writeClass( properties );
+ new CrudModuleWriter().writeClass( properties );
+ new ConnectivityLayerWriter().writeClass( properties );
+ new RestModuleWriter().writeClass( properties );
+
+ new ApplicationWriter().writeClass( properties );
+ new SimpleEnrolerWriter().writeClass( properties );
+ new SimpleVerifierWriter().writeClass( properties );
+
+ new SecurityModuleWriter().writeClass( properties );
+ new SecurityRepositoryWriter().writeClass( properties );
+ new HardCodedSecurityRepositoryMixinWriter().writeClass( properties );
+ new OrderWriter().writeClass( properties );
+ new OrderItemWriter().writeClass( properties );
+ new CustomerWriter().writeClass( properties );
+
+ new SettingsWriter().writeClass( properties );
+ new WebXmlWriter().writeClass( properties );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestProjectCreator.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestProjectCreator.java
deleted file mode 100644
index 513eb74..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestProjectCreator.java
+++ /dev/null
@@ -1,91 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-import org.apache.zest.tools.shell.create.project.restapp.ApplicationAssemblerWriter;
-import org.apache.zest.tools.shell.create.project.restapp.ApplicationWriter;
-import org.apache.zest.tools.shell.create.project.restapp.ConfigLayerWriter;
-import org.apache.zest.tools.shell.create.project.restapp.ConfigModuleWriter;
-import org.apache.zest.tools.shell.create.project.restapp.ConnectivityLayerWriter;
-import org.apache.zest.tools.shell.create.project.restapp.CrudModuleWriter;
-import org.apache.zest.tools.shell.create.project.restapp.CustomerWriter;
-import org.apache.zest.tools.shell.create.project.restapp.DomainLayerWriter;
-import org.apache.zest.tools.shell.create.project.restapp.FileConfigurationModuleWriter;
-import org.apache.zest.tools.shell.create.project.restapp.HardCodedSecurityRepositoryMixinWriter;
-import org.apache.zest.tools.shell.create.project.restapp.IndexingModuleWriter;
-import org.apache.zest.tools.shell.create.project.restapp.InfrastructureLayerWriter;
-import org.apache.zest.tools.shell.create.project.restapp.OrderItemWriter;
-import org.apache.zest.tools.shell.create.project.restapp.OrderWriter;
-import org.apache.zest.tools.shell.create.project.restapp.RestModuleWriter;
-import org.apache.zest.tools.shell.create.project.restapp.OrderModuleWriter;
-import org.apache.zest.tools.shell.create.project.restapp.SecurityModuleWriter;
-import org.apache.zest.tools.shell.create.project.restapp.SecurityRepositoryWriter;
-import org.apache.zest.tools.shell.create.project.restapp.SerializationModuleWriter;
-import org.apache.zest.tools.shell.create.project.restapp.SettingsWriter;
-import org.apache.zest.tools.shell.create.project.restapp.SimpleEnrolerWriter;
-import org.apache.zest.tools.shell.create.project.restapp.SimpleVerifierWriter;
-import org.apache.zest.tools.shell.create.project.restapp.StorageModuleWriter;
-import org.apache.zest.tools.shell.create.project.restapp.WebXmlWriter;
-
-public class RestProjectCreator extends AbstractProjectCreator
- implements ProjectCreator
-{
-
- @Override
- public void create( String projectName,
- File projectDir,
- Map<String, String> properties
- )
- throws IOException
- {
- super.create( projectName, projectDir, properties ); // creates the directory structures.
- new ApplicationAssemblerWriter().writeClass( properties );
- new ConfigLayerWriter().writeClass( properties );
- new ConfigModuleWriter().writeClass( properties );
- new InfrastructureLayerWriter().writeClass( properties );
- new FileConfigurationModuleWriter().writeClass( properties );
- new StorageModuleWriter().writeClass( properties );
- new IndexingModuleWriter().writeClass( properties );
- new SerializationModuleWriter().writeClass( properties );
- new DomainLayerWriter().writeClass( properties );
- new OrderModuleWriter().writeClass( properties );
- new CrudModuleWriter().writeClass( properties );
- new ConnectivityLayerWriter().writeClass( properties );
- new RestModuleWriter().writeClass( properties );
-
- new ApplicationWriter().writeClass( properties );
- new SimpleEnrolerWriter().writeClass( properties );
- new SimpleVerifierWriter().writeClass( properties );
-
- new SecurityModuleWriter().writeClass( properties );
- new SecurityRepositoryWriter().writeClass( properties );
- new HardCodedSecurityRepositoryMixinWriter().writeClass( properties );
- new OrderWriter().writeClass( properties );
- new OrderItemWriter().writeClass( properties );
- new CustomerWriter().writeClass( properties );
-
- new SettingsWriter().writeClass( properties );
- new WebXmlWriter().writeClass( properties );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/SingletonProjectCreator.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/SingletonProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/SingletonProjectCreator.java
new file mode 100644
index 0000000..4cf990a
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/SingletonProjectCreator.java
@@ -0,0 +1,39 @@
+/*
+ * 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.zest.tools.shell.create.project;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import org.apache.zest.tools.shell.create.project.singleton.SingletonApplicationAssemblerWriter;
+
+public class SingletonProjectCreator extends AbstractProjectCreator
+ implements ProjectCreator
+{
+
+ @Override
+ public void create( String projectName, File projectDir, Map<String, String> properties )
+ throws IOException
+ {
+ super.create( projectName, projectDir, properties ); // creates the directory structures.
+ new SingletonApplicationAssemblerWriter().writeClass( properties );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ApplicationAssemblerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ApplicationAssemblerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ApplicationAssemblerWriter.java
new file mode 100644
index 0000000..0ab880a
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ApplicationAssemblerWriter.java
@@ -0,0 +1,105 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class ApplicationAssemblerWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap;" );
+ pw.println();
+ pw.println( "import java.io.IOException;" );
+ pw.println( "import java.nio.file.Files;" );
+ pw.println( "import java.nio.file.Path;" );
+ pw.println( "import java.nio.file.Paths;" );
+ pw.println( "import java.util.function.Function;" );
+ pw.println();
+ pw.println( "import org.apache.zest.api.structure.Application;" );
+ pw.println( "import org.apache.zest.api.structure.Module;\n" );
+ pw.println( "import org.apache.zest.bootstrap.ApplicationAssembly;" );
+ pw.println( "import org.apache.zest.bootstrap.AssemblyException;" );
+ pw.println( "import org.apache.zest.bootstrap.LayerAssembly;" );
+ pw.println( "import org.apache.zest.bootstrap.ModuleAssembly;" );
+ pw.println( "import org.apache.zest.bootstrap.layered.LayeredApplicationAssembler;" );
+ pw.println();
+ pw.println( "import " + rootPackage + ".bootstrap.connectivity.ConnectivityLayer;" );
+ pw.println( "import " + rootPackage + ".bootstrap.domain.DomainLayer;" );
+ pw.println( "import " + rootPackage + ".bootstrap.config.ConfigurationLayer;" );
+ pw.println( "import " + rootPackage + ".bootstrap.infrastructure.InfrastructureLayer;" );
+ pw.println();
+ pw.print( "public class " );
+ pw.print( projectName );
+ pw.println( "ApplicationAssembler extends LayeredApplicationAssembler" );
+ pw.println( "{" );
+ pw.print( " private static final String NAME = \"" );
+ pw.print( projectName );
+ pw.println( "\";" );
+ pw.println( " private static final String VERSION = \"1.0.alpha\";" );
+ pw.println();
+ pw.print(" public ");
+ pw.print( projectName );
+ pw.println("ApplicationAssembler( Application.Mode mode )");
+ pw.println(" throws AssemblyException");
+ pw.println(" {");
+ pw.println(" super( NAME, VERSION, mode );");
+ pw.println(" }");
+ pw.println();
+ pw.println(" @Override");
+ pw.println(" protected void assembleLayers( ApplicationAssembly assembly )");
+ pw.println(" throws AssemblyException");
+ pw.println(" {");
+ pw.println(" LayerAssembly configLayer = createLayer( ConfigurationLayer.class );");
+ pw.println(" ModuleAssembly configModule = assemblerOf( ConfigurationLayer.class ).configModule();");
+ pw.println(" LayerAssembly domainLayer = createLayer( DomainLayer.class );");
+ pw.println(" Function<Application, Module> typeFinder = DomainLayer.typeFinder();");
+ pw.println(" LayerAssembly infraLayer = new InfrastructureLayer( configModule, typeFinder ).assemble( assembly.layer( InfrastructureLayer.NAME ) );");
+ pw.println(" LayerAssembly connectivityLayer = createLayer( ConnectivityLayer.class );");
+ pw.println(" connectivityLayer.uses( domainLayer );");
+ pw.println(" domainLayer.uses( infraLayer );");
+ pw.println(" infraLayer.uses( configLayer );");
+ pw.println(" }");
+ pw.println("}");
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/";
+ String classname = properties.get( "project.name" ) + "ApplicationAssembler";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ));
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigLayerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigLayerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigLayerWriter.java
new file mode 100644
index 0000000..e79ae20
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigLayerWriter.java
@@ -0,0 +1,81 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class ConfigLayerWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.config;" );
+ pw.println();
+ pw.println(
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.LayerAssembler;\n" +
+ "import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;\n" +
+ "\n" +
+ "public class ConfigurationLayer extends LayeredLayerAssembler\n" +
+ " implements LayerAssembler\n" +
+ "{\n" +
+ " public static final String NAME = \"Configuration Layer\";\n" +
+ " private ModuleAssembly configModule;\n" +
+ "\n" +
+ " @Override\n" +
+ " public LayerAssembly assemble( LayerAssembly layer )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " configModule = createModule( layer, ConfigModule.class );\n" +
+ " return layer;\n" +
+ " }\n" +
+ "\n" +
+ " public ModuleAssembly configModule()\n" +
+ " {\n" +
+ " return configModule;\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/config/";
+ String classname = "ConfigurationLayer";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigModuleWriter.java
new file mode 100644
index 0000000..0c792e3
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigModuleWriter.java
@@ -0,0 +1,77 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class ConfigModuleWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.config;" );
+ pw.println();
+ pw.println(
+ "import org.apache.zest.api.common.Visibility;\n" +
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
+ "import org.apache.zest.entitystore.memory.MemoryEntityStoreService;\n" +
+ "import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;\n" +
+ "import org.apache.zest.valueserialization.jackson.JacksonValueSerializationAssembler;\n" +
+ "\n" +
+ "public class ConfigModule\n" +
+ " implements ModuleAssembler\n" +
+ "{\n" +
+ " @Override\n" +
+ " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.layer );\n" +
+ " new JacksonValueSerializationAssembler().visibleIn( Visibility.layer ).assemble( module );\n" +
+ " module.services( UuidIdentityGeneratorService.class ).visibleIn( Visibility.layer );\n" +
+ " return module;\n" +
+ " }\n" +
+ "}\n");
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/config/";
+ String classname = "ConfigModule";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConnectivityLayerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConnectivityLayerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConnectivityLayerWriter.java
new file mode 100644
index 0000000..98ea384
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConnectivityLayerWriter.java
@@ -0,0 +1,74 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class ConnectivityLayerWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.connectivity;" );
+ pw.println();
+ pw.println(
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.LayerAssembler;\n" +
+ "import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;\n" +
+ "\n" +
+ "public class ConnectivityLayer extends LayeredLayerAssembler\n" +
+ " implements LayerAssembler\n" +
+ "{\n" +
+ " public static String NAME;\n" +
+ "\n" +
+ " @Override\n" +
+ " public LayerAssembly assemble( LayerAssembly layer )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " createModule( layer, RestModule.class );\n" +
+ " return layer;\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/connectivity/";
+ String classname = "ConnectivityLayer";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CrudModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CrudModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CrudModuleWriter.java
new file mode 100644
index 0000000..3d8904e
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CrudModuleWriter.java
@@ -0,0 +1,74 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class CrudModuleWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".bootstrap.domain;" );
+ pw.println();
+ pw.println(
+ "import org.apache.zest.bootstrap.AssemblyException;\n" +
+ "import org.apache.zest.bootstrap.LayerAssembly;\n" +
+ "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
+ "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
+ "import org.apache.zest.library.restlet.assembly.CrudServiceAssembler;\n" +
+ "\n" +
+ "public class CrudModule\n" +
+ " implements ModuleAssembler\n" +
+ "{\n" +
+ " @Override\n" +
+ " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " module.withDefaultUnitOfWorkFactory();\n" +
+ " new CrudServiceAssembler().assemble( module );\n" +
+ " return module;\n" +
+ " }\n" +
+ "}\n"
+ );
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/domain/";
+ String classname = "CrudModule";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CustomerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CustomerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CustomerWriter.java
new file mode 100644
index 0000000..accc7e6
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CustomerWriter.java
@@ -0,0 +1,68 @@
+/*
+ * 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.zest.tools.shell.create.project.common;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class CustomerWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".model.orders;" );
+ pw.println();
+ pw.println("import java.time.ZonedDateTime;");
+ pw.println("import org.apache.zest.api.entity.Identity;");
+ pw.println("import org.apache.zest.api.property.Property;");
+ pw.println();
+ pw.println(
+ "public interface Customer extends Identity\n" +
+ "{\n" +
+ " Property<String> name();\n\n" +
+ " Property<String> address();\n\n" +
+ " Property<String> city();\n\n" +
+ " Property<String> country();\n\n" +
+ " Property<String> phone();\n\n" +
+ " Property<ZonedDateTime> registered();\n\n" +
+ "}\n");
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/model/orders/";
+ String classname = "Customer";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "model/src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
[2/5] zest-java git commit: Forgotten to call the super.assemble() in
other serialization tests.
Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/FileConfigurationModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/FileConfigurationModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/FileConfigurationModuleWriter.java
deleted file mode 100644
index fa6e669..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/FileConfigurationModuleWriter.java
+++ /dev/null
@@ -1,76 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class FileConfigurationModuleWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.infrastructure;" );
- pw.println();
- pw.println(
- "import org.apache.zest.api.common.Visibility;\n" +
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
- "import org.apache.zest.library.fileconfig.FileConfigurationAssembler;\n" +
- "\n" +
- "public class FileConfigurationModule\n" +
- " implements ModuleAssembler\n" +
- "{\n" +
- " public static String NAME;\n" +
- "\n" +
- " @Override\n" +
- " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
- " throws AssemblyException\n" +
- " {\n" +
- " new FileConfigurationAssembler().visibleIn( Visibility.layer ).assemble( module );\n" +
- " return module;\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/infrastructure/";
- String classname = "FileConfigurationModule";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/HardCodedSecurityRepositoryMixinWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/HardCodedSecurityRepositoryMixinWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/HardCodedSecurityRepositoryMixinWriter.java
deleted file mode 100644
index a29bca4..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/HardCodedSecurityRepositoryMixinWriter.java
+++ /dev/null
@@ -1,87 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class HardCodedSecurityRepositoryMixinWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".model.security;" );
- pw.println();
- pw.println(
- "import java.util.Collections;\n" +
- "import java.util.List;\n" +
- "import org.apache.zest.api.unitofwork.concern.UnitOfWorkPropagation;\n" +
- "\n" +
- "public class HardcodedSecurityRepositoryMixin\n" +
- " implements SecurityRepository\n" +
- "{\n" +
- "\n" +
- " @Override\n" +
- " public boolean verifyPassword( String userName, String password )\n" +
- " {\n" +
- " if( userName.equals(\"admin\") && password.equals(\"secret\") )" +
- " {\n" +
- " return true;\n" +
- " }\n" +
- " if( userName.equals(\"user\") && password.equals(\"123\") )" +
- " {\n" +
- " return true;\n" +
- " }\n" +
- " return false;\n" +
- " }\n" +
- "\n" +
- " @UnitOfWorkPropagation\n" +
- " public List<String> findRoleNamesOfUser( String name )\n" +
- " {\n" +
- " if( \"admin\".equals( name ) )\n" +
- " {\n" +
- " return Collections.singletonList(\"admin\");\n" +
- " }\n" +
- " return Collections.singletonList(\"user\");\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/model/security/";
- String classname = "HardcodedSecurityRepositoryMixin";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "model/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/IndexingModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/IndexingModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/IndexingModuleWriter.java
deleted file mode 100644
index bcdc04d..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/IndexingModuleWriter.java
+++ /dev/null
@@ -1,86 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class IndexingModuleWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.infrastructure;" );
- pw.println();
- pw.println(
- "import org.apache.zest.api.common.Visibility;\n" +
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
- "import org.apache.zest.index.rdf.assembly.RdfNativeSesameStoreAssembler;\n" +
- "import org.apache.zest.library.rdf.repository.NativeConfiguration;\n" +
- "\n" +
- "public class IndexingModule\n" +
- " implements ModuleAssembler\n" +
- "{\n" +
- " public static final String NAME = \"Indexing Module\";\n" +
- " private final ModuleAssembly configModule;\n" +
- "\n" +
- " public IndexingModule( ModuleAssembly configModule )\n" +
- " {\n" +
- " this.configModule = configModule;\n" +
- " }\n" +
- "\n" +
- " @Override\n" +
- " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
- " throws AssemblyException\n" +
- " {\n" +
- " module.withDefaultUnitOfWorkFactory();\n" +
- "\n" +
- " configModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application );\n" +
- " new RdfNativeSesameStoreAssembler(Visibility.application, Visibility.module).assemble( module );\n" +
- " return module;\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/infrastructure/";
- String classname = "IndexingModule";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/InfrastructureLayerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/InfrastructureLayerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/InfrastructureLayerWriter.java
deleted file mode 100644
index c899999..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/InfrastructureLayerWriter.java
+++ /dev/null
@@ -1,91 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class InfrastructureLayerWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.infrastructure;" );
- pw.println();
- pw.println(
- "import java.util.function.Function;\n" +
- "import org.apache.zest.api.structure.Application;\n" +
- "import org.apache.zest.api.structure.Module;\n" +
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.LayerAssembler;\n" +
- "import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;\n" +
- "\n" +
- "public class InfrastructureLayer extends LayeredLayerAssembler\n" +
- " implements LayerAssembler\n" +
- "{\n" +
- " public static final String NAME = \"Infrastructure Layer\";\n" +
- " private final ModuleAssembly configModule;\n" +
- " private final Function<Application, Module> typeFinder;\n" +
- "\n" +
- " public InfrastructureLayer( ModuleAssembly configModule, Function<Application, Module> typeFinder )\n" +
- " {\n" +
- " this.configModule = configModule;\n" +
- " this.typeFinder = typeFinder;\n" +
- " }\n" +
- "\n" +
- " @Override\n" +
- " public LayerAssembly assemble( LayerAssembly layer )\n" +
- " throws AssemblyException\n" +
- " {\n" +
- " createModule( layer, FileConfigurationModule.class );\n" +
- "\n" +
- " new StorageModule( configModule ).assemble( layer, layer.module( StorageModule.NAME ) );\n" +
- " new IndexingModule( configModule ).assemble( layer, layer.module( IndexingModule.NAME ) );\n" +
- " new SerializationModule( typeFinder ).assemble( layer, layer.module( SerializationModule.NAME ) );\n" +
- "\n" +
- " return layer;\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/infrastructure/";
- String classname = "InfrastructureLayer";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderItemWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderItemWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderItemWriter.java
deleted file mode 100644
index 25db54f..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderItemWriter.java
+++ /dev/null
@@ -1,66 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class OrderItemWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".model.orders;" );
- pw.println();
- pw.println("import java.math.BigDecimal;");
- pw.println("import org.apache.zest.api.entity.Identity;");
- pw.println("import org.apache.zest.api.property.Property;");
- pw.println();
- pw.println(
- "public interface OrderItem extends Identity\n" +
- "{\n" +
- " Property<String> partNumber();\n\n" +
- " Property<BigDecimal> unitPrice();\n\n" +
- " Property<Integer> units();\n\n" +
- " Property<BigDecimal> discount();\n\n" +
- "}\n");
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/model/orders/";
- String classname = "OrderItem";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "model/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderModuleWriter.java
deleted file mode 100644
index df8a7da..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderModuleWriter.java
+++ /dev/null
@@ -1,85 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-import static java.lang.String.format;
-
-public class OrderModuleWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.domain;" );
- pw.println();
- pw.println(
- "import org.apache.zest.api.common.Visibility;\n" +
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.ModuleAssembler;");
- pw.println(format("import %s.model.orders.Order;", rootPackage));
- pw.println(format("import %s.model.orders.OrderItem;", rootPackage));
- pw.println(format("import %s.model.orders.Customer;", rootPackage));
- pw.println();
- pw.println(
- "public class OrderModule\n" +
- " implements ModuleAssembler\n" +
- "{\n" +
- " public static String NAME;\n" +
- "\n" +
- " @Override\n" +
- " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
- " throws AssemblyException\n" +
- " {\n" +
- " module.values( /* add value types */ );\n" +
- " module.entities( Customer.class, Order.class, OrderItem.class );\n" +
- " module.services( /* add services */ )\n" +
- " .visibleIn( Visibility.layer )\n" +
- " .instantiateOnStartup();\n" +
- " return module;\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/domain/";
- String classname = "OrderModule";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderWriter.java
deleted file mode 100644
index 63d7003..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderWriter.java
+++ /dev/null
@@ -1,71 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class OrderWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".model.orders;" );
- pw.println();
- pw.println("import java.time.ZonedDateTime;");
- pw.println("import org.apache.zest.api.association.Association;");
- pw.println("import org.apache.zest.api.association.ManyAssociation;");
- pw.println("import org.apache.zest.api.common.Optional;");
- pw.println("import org.apache.zest.api.entity.Identity;");
- pw.println("import org.apache.zest.api.property.Property;");
- pw.println();
- pw.println(
- "public interface Order extends Identity\n" +
- "{\n" +
- " Property<String> orderNumber();\n\n" +
- " Property<ZonedDateTime> registered();\n\n" +
- " @Optional\n" +
- " Property<ZonedDateTime> shipped();\n\n" +
- " Association<Customer> customer();\n\n" +
- " ManyAssociation<OrderItem> items();\n\n" +
- "}\n");
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/model/orders/";
- String classname = "Order";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "model/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityModuleWriter.java
deleted file mode 100644
index bdbd512..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityModuleWriter.java
+++ /dev/null
@@ -1,88 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-import static java.lang.String.format;
-
-public class SecurityModuleWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.domain;" );
- pw.println();
- pw.println(
- "import org.apache.zest.api.common.Visibility;\n" +
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.ModuleAssembler;");
- pw.println(format("import %s.model.orders.Order;", rootPackage));
- pw.println(format("import %s.model.orders.OrderItem;", rootPackage));
- pw.println(format("import %s.model.orders.Customer;", rootPackage));
- pw.println(format("import %s.model.security.SecurityRepository;", rootPackage));
- pw.println(format("import %s.model.security.HardcodedSecurityRepositoryMixin;", rootPackage));
- pw.println();
- pw.println(
- "public class SecurityModule\n" +
- " implements ModuleAssembler\n" +
- "{\n" +
- " public static String NAME;\n" +
- "\n" +
- " @Override\n" +
- " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
- " throws AssemblyException\n" +
- " {\n" +
- " module.withDefaultUnitOfWorkFactory();\n" +
- " module.services( SecurityRepository.class )\n" +
- " .withMixins( HardcodedSecurityRepositoryMixin.class )\n" +
- " .visibleIn( Visibility.application )\n" +
- " .instantiateOnStartup();\n" +
- "\n" +
- " return module;\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/domain/";
- String classname = "SecurityModule";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityRepositoryWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityRepositoryWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityRepositoryWriter.java
deleted file mode 100644
index abe5083..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SecurityRepositoryWriter.java
+++ /dev/null
@@ -1,71 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-import static java.lang.String.format;
-
-public class SecurityRepositoryWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".model.security;" );
- pw.println();
- pw.println(
- "import java.util.List;\n" +
- "import org.apache.zest.api.concern.Concerns;\n" +
- "import org.apache.zest.api.unitofwork.concern.UnitOfWorkConcern;\n" +
- "import org.apache.zest.api.unitofwork.concern.UnitOfWorkPropagation;\n" +
- "\n" +
- "@Concerns( UnitOfWorkConcern.class )\n" +
- "public interface SecurityRepository\n" +
- "{\n" +
- " @UnitOfWorkPropagation\n" +
- " boolean verifyPassword( String user, String password );\n" +
- "\n" +
- " @UnitOfWorkPropagation\n" +
- " List<String> findRoleNamesOfUser( String name );\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/model/security/";
- String classname = "SecurityRepository";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "model/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SerializationModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SerializationModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SerializationModuleWriter.java
deleted file mode 100644
index b2e8aa2..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SerializationModuleWriter.java
+++ /dev/null
@@ -1,90 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class SerializationModuleWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.infrastructure;" );
- pw.println();
- pw.println(
- "import java.util.function.Function;\n" +
- "import org.apache.zest.api.common.Visibility;\n" +
- "import org.apache.zest.api.structure.Application;\n" +
- "import org.apache.zest.api.structure.Module;\n" +
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
- "import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;\n" +
- "import org.apache.zest.valueserialization.jackson.JacksonValueSerializationAssembler;\n" +
- "\n" +
- "public class SerializationModule\n" +
- " implements ModuleAssembler\n" +
- "{\n" +
- " public static final String NAME = \"Serialization Module\";\n" +
- " private final Function<Application, Module> typeFinder;\n" +
- "\n" +
- " public SerializationModule( Function<Application, Module> typeFinder )\n" +
- " {\n" +
- " this.typeFinder = typeFinder;\n" +
- " }\n" +
- "\n" +
- " @Override\n" +
- " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
- " throws AssemblyException\n" +
- " {\n" +
- " new JacksonValueSerializationAssembler()\n" +
- " .visibleIn( Visibility.application )\n" +
- " .withValuesModuleFinder( typeFinder )\n" +
- " .assemble( module );\n" +
- " module.services( UuidIdentityGeneratorService.class ).visibleIn( Visibility.layer );\n" +
- " return module;\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/infrastructure/";
- String classname = "SerializationModule";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SettingsWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SettingsWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SettingsWriter.java
deleted file mode 100644
index abf621b..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/SettingsWriter.java
+++ /dev/null
@@ -1,75 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class SettingsWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.println(
- String.format(
- "\n" +
- "include 'app',\n" +
- " 'bootstrap',\n" +
- " 'model',\n" +
- " 'rest'\n" +
- "\n" +
- "rootProject.name = \"%s\"\n" +
- "\n" +
- "validateProject(rootProject, \"\")\n" +
- "\n" +
- "def validateProject(project, parentName)\n" +
- "{\n" +
- " assert project.projectDir.isDirectory()\n" +
- " if( new File(\"$project.projectDir/src/main/java\").exists() )\n" +
- " {\n" +
- " assert project.buildFile.isFile()\n" +
- " }\n" +
- " if( parentName.length() > 0 )\n" +
- " println \"Project: \" + project.name\n" +
- " project.children.each { child ->\n" +
- " validateProject(child, project.name)\n" +
- " }\n" +
- "}\n" +
- "\n", projectName
- ));
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "settings.gradle" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/StorageModuleWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/StorageModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/StorageModuleWriter.java
deleted file mode 100644
index 579b3da..0000000
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/StorageModuleWriter.java
+++ /dev/null
@@ -1,87 +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.
- *
- *
- */
-
-package org.apache.zest.tools.shell.create.project.restapp;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-public class StorageModuleWriter
-{
-
- public void writeClass( Map<String, String> properties )
- throws IOException
- {
- String rootPackage = properties.get( "root.package" );
- String projectName = properties.get( "project.name" );
- try (PrintWriter pw = createPrinter( properties ))
- {
- pw.print( "package " );
- pw.print( properties.get( "root.package" ) );
- pw.println( ".bootstrap.infrastructure;" );
- pw.println();
- pw.println(
- "import org.apache.zest.api.common.Visibility;\n" +
- "import org.apache.zest.bootstrap.AssemblyException;\n" +
- "import org.apache.zest.bootstrap.LayerAssembly;\n" +
- "import org.apache.zest.bootstrap.ModuleAssembly;\n" +
- "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" +
- "import org.apache.zest.entitystore.file.assembly.FileEntityStoreAssembler;\n" +
- "\n" +
- "public class StorageModule\n" +
- " implements ModuleAssembler\n" +
- "{\n" +
- " public static final String NAME = \"Storage Module\";\n" +
- " private final ModuleAssembly configModule;\n" +
- "\n" +
- " public StorageModule( ModuleAssembly configModule )\n" +
- " {\n" +
- " this.configModule = configModule;\n" +
- " }\n" +
- "\n" +
- " @Override\n" +
- " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" +
- " throws AssemblyException\n" +
- " {\n" +
- "\n" +
- " new FileEntityStoreAssembler()\n" +
- " .visibleIn( Visibility.application )\n" +
- " .withConfig( configModule, Visibility.application )\n" +
- " .identifiedBy( \"filestore\" )\n" +
- " .assemble( module );\n" +
- " return module;\n" +
- " }\n" +
- "}\n"
- );
- }
- }
-
- private PrintWriter createPrinter( Map<String, String> properties )
- throws IOException
- {
- String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/infrastructure/";
- String classname = "StorageModule";
- File projectDir = new File( properties.get( "project.dir" ) );
- return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/singleton/SingletonApplicationAssemblerWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/singleton/SingletonApplicationAssemblerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/singleton/SingletonApplicationAssemblerWriter.java
new file mode 100644
index 0000000..8a125a7
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/singleton/SingletonApplicationAssemblerWriter.java
@@ -0,0 +1,105 @@
+/*
+ * 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.zest.tools.shell.create.project.singleton;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+import static java.lang.String.format;
+
+public class SingletonApplicationAssemblerWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ".app;" );
+ pw.println();
+ pw.println( "import org.apache.zest.api.structure.Application;" );
+ pw.println( "import org.apache.zest.bootstrap.AssemblyException;" );
+ pw.println();
+ pw.println( format( "public class %s", projectName ) );
+ pw.println( "{\n" );
+ pw.println( " public static void main( String[] args )");
+ pw.println( " throws Exception" );
+ pw.println( " {" );
+ pw.println( " SingletonAssembly app = new SingletonAssembly()" );
+ pw.println( " {" );
+ pw.println( " @Override\n" +
+ " public void assemble( ModuleAssembly module )\n" +
+ " throws AssemblyException\n" +
+ " {\n" +
+ " module.values( );\n" +
+ " module.entities( );\n" +
+ " module.services( StartupService.class );\n" +
+ " .instantiateOnStartup();\n" +
+ " }\n" );
+ pw.println( " }" );
+ pw.println();
+ pw.println( " registerShutdownHook();" );
+ pw.println( " StartupService startup = app.serviceFinder().findService( StartupService.class );" );
+ pw.println();
+ pw.println( " // Here the application is ready to do something." );
+ pw.println( " // You should add functionality in the StartupService class." );
+ pw.println( " }" );
+ pw.println( );
+ pw.println( " private void registerShutdownHook()" );
+ pw.println( " {" );
+ pw.println( " Runtime.getRuntime().addShutdownHook( new Thread( new Runnable()\n" +
+ " {\n" +
+ " @Override\n" +
+ " public void run()\n" +
+ " {\n" +
+ " try\n" +
+ " {\n" +
+ " app.passivate();\n" +
+ " }\n" +
+ " catch( Exception e )\n" +
+ " {\n" +
+ " System.err.println( \"Clean Shutdown of application failed.\" );\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " }\n" +
+ " }, \"Shutdown Hook for Zest\" ) );\n" );
+ pw.println( " }" );
+ pw.println( "}" );
+ pw.println();
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" );
+ String classname = properties.get("project.name");
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/singleton/StartupServiceWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/singleton/StartupServiceWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/singleton/StartupServiceWriter.java
new file mode 100644
index 0000000..669821c
--- /dev/null
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/singleton/StartupServiceWriter.java
@@ -0,0 +1,70 @@
+/*
+ * 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.zest.tools.shell.create.project.singleton;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class StartupServiceWriter
+{
+
+ public void writeClass( Map<String, String> properties )
+ throws IOException
+ {
+ String rootPackage = properties.get( "root.package" );
+ String projectName = properties.get( "project.name" );
+ try (PrintWriter pw = createPrinter( properties ))
+ {
+ pw.print( "package " );
+ pw.print( properties.get( "root.package" ) );
+ pw.println( ";" );
+ pw.println();
+ pw.println("import org.apache.zest.api.activation.Activation;");
+ pw.println();
+ pw.println(
+ "public interface StartupService\n" +
+ " implements Activation\n" +
+ "{\n" +
+ " public void activate()\n" +
+ " {\n" +
+ " // TODO This method is called when the application starts.\n" +
+ " }\n" +
+ "\n" +
+ " public void passivate()\n" +
+ " {\n" +
+ " // TODO This method is called when the application shutsdown.\n" +
+ " }\n" +
+ "}\n");
+ }
+ }
+
+ private PrintWriter createPrinter( Map<String, String> properties )
+ throws IOException
+ {
+ String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" );
+ String classname = "StartupService";
+ File projectDir = new File( properties.get( "project.dir" ) );
+ return new PrintWriter( new FileWriter( new File( projectDir, "src/main/java/" + packagename + classname + ".java" ) ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/help/HelpCommand.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/help/HelpCommand.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/help/HelpCommand.java
index 3f52f3b..814a755 100644
--- a/tools/shell/src/main/java/org/apache/zest/tools/shell/help/HelpCommand.java
+++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/help/HelpCommand.java
@@ -42,7 +42,7 @@ public class HelpCommand extends AbstractCommand
{
for( Command command : commands )
{
- output.println( command.name() + "\t" + command.description() );
+ output.println( command.name() + " " + command.description() );
}
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/resources/templates/default/project.properties
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/resources/templates/default/project.properties b/tools/shell/src/main/resources/templates/default/project.properties
index 54f42b7..e66c148 100644
--- a/tools/shell/src/main/resources/templates/default/project.properties
+++ b/tools/shell/src/main/resources/templates/default/project.properties
@@ -18,3 +18,7 @@
#
#
+
+creator.class=org.apache.zest.tools.shell.create.project.DefaultProjectCreator
+
+template.dir=etc/templates/default/files
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/resources/templates/null/project.properties
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/resources/templates/null/project.properties b/tools/shell/src/main/resources/templates/null/project.properties
new file mode 100644
index 0000000..d26b377
--- /dev/null
+++ b/tools/shell/src/main/resources/templates/null/project.properties
@@ -0,0 +1,25 @@
+#
+# 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.
+
+
+# This project template is the absolute minimal project possible.
+# Only creates a build file and directory structure for java sources.
+
+
+creator.class=org.apache.zest.tools.shell.create.project.NullProjectCreator
+
+template.dir=etc/templates/null/files
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/resources/templates/restapp/project.properties
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/resources/templates/restapp/project.properties b/tools/shell/src/main/resources/templates/restapp/project.properties
index 4c33430..dc97019 100644
--- a/tools/shell/src/main/resources/templates/restapp/project.properties
+++ b/tools/shell/src/main/resources/templates/restapp/project.properties
@@ -18,6 +18,6 @@
#
#
-creator.class=org.apache.zest.tools.shell.create.project.RestProjectCreator
+creator.class=org.apache.zest.tools.shell.create.project.RestAppProjectCreator
-template.dir=etc/templates/restproject/files
\ No newline at end of file
+template.dir=etc/templates/restapp/files
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/resources/templates/singleton/project.properties
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/resources/templates/singleton/project.properties b/tools/shell/src/main/resources/templates/singleton/project.properties
new file mode 100644
index 0000000..d504d1d
--- /dev/null
+++ b/tools/shell/src/main/resources/templates/singleton/project.properties
@@ -0,0 +1,24 @@
+#
+# 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.
+
+# This template create a simple project with a single layer and a single module.
+# It is based around the SingletonAssembler.
+
+
+creator.class=org.apache.zest.tools.shell.create.project.SingletonProjectCreator
+
+template.dir=etc/templates/singleton/files
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/test/java/org/apache/zest/tools/shell/FileUtilsTest.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/test/java/org/apache/zest/tools/shell/FileUtilsTest.java b/tools/shell/src/test/java/org/apache/zest/tools/shell/FileUtilsTest.java
new file mode 100644
index 0000000..2867041
--- /dev/null
+++ b/tools/shell/src/test/java/org/apache/zest/tools/shell/FileUtilsTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.zest.tools.shell;
+
+import java.io.File;
+import java.util.Map;
+import org.junit.Test;
+
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+
+public class FileUtilsTest
+{
+ @Test
+ public void createDirectoryTest()
+ {
+ File f = new File( "habba-zout" );
+ if( f.exists() )
+ {
+ FileUtils.removeDir( f );
+ }
+ assertThat( f.exists(), equalTo( false ) );
+ FileUtils.createDir( "habba-zout" );
+ assertThat( f.exists(), equalTo( true ) );
+ if( ! f.delete() ){
+ System.err.println( "Unable to remove file. Why???" );
+ }
+ assertThat( f.exists(), equalTo( false ) );
+ }
+
+ @Test
+ public void removeDirTest() throws Exception {
+ File srcFile = new File("build.gradle");
+ File f = new File( "habba-zout" );
+ if( f.exists() )
+ {
+ FileUtils.removeDir( f );
+ }
+ assertThat( f.exists(), equalTo( false ) );
+ File f1 = FileUtils.createDir( "habba-zout" );
+ File f2 = FileUtils.createDir( "habba-zout/src" );
+ File f3 = FileUtils.createDir( "habba-zout/src/main" );
+ File f4 = FileUtils.createDir( "habba-zout/src/test" );
+ File f5 = FileUtils.createDir( "habba-zout/src/main/abc" );
+ FileUtils.copyFile( srcFile, new File(f1, "build.gradle__") );
+ FileUtils.copyFile( srcFile, new File(f2, "build.gradle__") );
+ FileUtils.copyFile( srcFile, new File(f3, "build.gradle__") );
+ FileUtils.copyFile( srcFile, new File(f4, "build.gradle__") );
+ FileUtils.copyFile( srcFile, new File(f5, "build.gradle__") );
+ boolean success = FileUtils.removeDir( f );
+ assertThat(success, equalTo(true));
+ assertThat(f1.exists(), equalTo(false));
+ assertThat(f2.exists(), equalTo(false));
+ assertThat(f3.exists(), equalTo(false));
+ assertThat(f4.exists(), equalTo(false));
+ assertThat(f5.exists(), equalTo(false));
+ }
+
+ @Test
+ public void readPropertiesResourceTest()
+ {
+
+ Map<String, String> map = FileUtils.readPropertiesResource( "templates/restapp/project.properties" );
+ assertThat( map, notNullValue() );
+ assertThat( map.get( "template.dir" ), equalTo( "etc/templates/restapp/files" ) );
+ }
+
+ @Test
+ public void copyFileTest()
+ throws Exception
+ {
+ File dest = new File( "build.gradle.copy" );
+ if( dest.exists() ) // from an earlier aborted run.
+ {
+ if( ! dest.delete() ){
+ System.err.println( "Unable to remove file. Why???" );
+ }
+ }
+ File srcFile = new File( "build.gradle" );
+ FileUtils.copyFile( srcFile, dest );
+ assertThat( dest.exists(), equalTo( true ) );
+ if( ! dest.delete() ){
+ System.err.println( "Unable to remove file. Why???" );
+ }
+ assertThat( dest.exists(), equalTo( false ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/test/java/org/apache/zest/tools/shell/HelpNeededExceptionTest.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/test/java/org/apache/zest/tools/shell/HelpNeededExceptionTest.java b/tools/shell/src/test/java/org/apache/zest/tools/shell/HelpNeededExceptionTest.java
new file mode 100644
index 0000000..bcd871e
--- /dev/null
+++ b/tools/shell/src/test/java/org/apache/zest/tools/shell/HelpNeededExceptionTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.zest.tools.shell;
+
+import org.apache.zest.tools.shell.create.CreateProject;
+import org.junit.Test;
+
+public class HelpNeededExceptionTest
+{
+ @Test(expected = HelpNeededException.class )
+ public void helpTest() {
+ new CreateProject().execute( new String[0], null, null );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/test/java/org/apache/zest/tools/shell/TestHelper.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/test/java/org/apache/zest/tools/shell/TestHelper.java b/tools/shell/src/test/java/org/apache/zest/tools/shell/TestHelper.java
new file mode 100644
index 0000000..e0389a9
--- /dev/null
+++ b/tools/shell/src/test/java/org/apache/zest/tools/shell/TestHelper.java
@@ -0,0 +1,41 @@
+/*
+ * 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.zest.tools.shell;
+
+import java.io.File;
+
+public class TestHelper
+{
+ public static void zetZestZome()
+ {
+ String cwd = new File( ".").getAbsolutePath();
+ if( cwd.endsWith( "/java/." )) // IDEA default runner
+ {
+ String zestHome = new File( new File(".").getAbsoluteFile(), "tools/shell/src" ).getAbsolutePath();
+ System.setProperty( "zest.home", zestHome );
+ }
+ if( cwd.endsWith( "tools/shell/." )) // Gradle build
+ {
+ String zestHome = new File( new File(".").getAbsoluteFile(), "src" ).getAbsolutePath();
+ System.setProperty( "zest.home", zestHome );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/test/java/org/apache/zest/tools/shell/create/CreateProjectTest.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/test/java/org/apache/zest/tools/shell/create/CreateProjectTest.java b/tools/shell/src/test/java/org/apache/zest/tools/shell/create/CreateProjectTest.java
new file mode 100644
index 0000000..58b2a83
--- /dev/null
+++ b/tools/shell/src/test/java/org/apache/zest/tools/shell/create/CreateProjectTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.zest.tools.shell.create;
+
+import java.io.File;
+import org.apache.zest.tools.shell.FileUtils;
+import org.apache.zest.tools.shell.HelpNeededException;
+import org.apache.zest.tools.shell.TestHelper;
+import org.junit.Test;
+
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+
+public class CreateProjectTest
+{
+ private CreateProject underTest = new CreateProject();
+
+ @Test
+ public void givenCommandWhenRequestNameExpectName()
+ {
+ assertThat( underTest.name(), equalTo( "create-project" ) );
+ }
+
+ @Test
+ public void givenCommandWhenRequestDescriptionExpectDescription()
+ {
+ assertThat( underTest.description(), equalTo( "type name package\tCreates a new skeletal project in directory [name]." ) );
+ }
+
+ @Test( expected = HelpNeededException.class )
+ public void givenCommandWhenTemplateDoesNotExistExpectException()
+ {
+ new CreateProject().execute( new String[]{ "habba", "ZestTest", "org.apache.zest" }, null, null );
+ }
+
+ @Test
+ public void givenCommandWhenTemplateExistExpectCreatedProject()
+ {
+ TestHelper.zetZestZome();
+ File dest = new File( "ZestTest" );
+ new CreateProject().execute( new String[]{ "create-project", "null", "ZestTest", "org.apache.zest" }, null, null );
+
+ assertThat( dest.exists(), equalTo( true ) );
+ assertThat( new File(dest, "src/main/java/org/apache/zest/package.html").exists(), equalTo( true ) );
+ if( FileUtils.removeDir( dest ) )
+ {
+ System.err.println( "Unable to remove file. Why???" );
+ }
+ assertThat( dest.exists(), equalTo( false ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreatorTest.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreatorTest.java b/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreatorTest.java
new file mode 100644
index 0000000..387fc5f
--- /dev/null
+++ b/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreatorTest.java
@@ -0,0 +1,108 @@
+/*
+ * 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.zest.tools.shell.create.project;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.zest.tools.shell.FileUtils;
+import org.apache.zest.tools.shell.TestHelper;
+import org.junit.Test;
+
+import static org.apache.zest.tools.shell.FileUtils.removeDir;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+
+public class DefaultProjectCreatorTest
+{
+ private DefaultProjectCreator underTest = new DefaultProjectCreator();
+
+ @Test
+ public void givenCorrectInputWhenCreatedProjectExpectCompleteProjectCreated()
+ throws Exception
+ {
+
+ TestHelper.zetZestZome();
+ File projectDir = new File( "ZestTest" );
+ if( projectDir.exists() )
+ {
+ removeDir( projectDir );
+ }
+ Map<String, String> properties = new HashMap<>();
+ properties.put( "zest.home", System.getProperty( "zest.home" ) );
+ properties.put( "root.package", "org.apache.zest.test" );
+ properties.put( "project.dir", "ZestTest" );
+ properties.put( "project.name", "ZestTest" );
+ properties.put( "template.dir", "etc/templates/restapp/files" );
+ underTest.create( "ZestTest", projectDir, properties );
+
+ assertThat( projectDir.exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/build.gradle" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src/main/resources" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src/main/java/org/apache/zest/test/app/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src/main/java/org/apache/zest/test/app/ZestTest.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/resources" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/ConfigModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/ConfigurationLayer.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/connectivity/ConnectivityLayer.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/connectivity/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/CrudModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/DomainLayer.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/OrderModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/SecurityModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/FileConfigurationModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/IndexingModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/InfrastructureLayer.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/SerializationModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/StorageModule.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/ZestTestApplicationAssembler.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "app/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/build.gradle" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/main/resources" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "bootstrap/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/build.gradle" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/resources" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/Customer.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/Order.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/OrderItem.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/HardcodedSecurityRepositoryMixin.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/SecurityRepository.java" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "model/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "gradle/wrapper/gradle-wrapper.jar" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "gradle/wrapper/gradle-wrapper.properties" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "gradlew" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "gradlew.bat" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "build.gradle" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "settings.gradle" ).exists(), equalTo( true ) );
+ if( FileUtils.removeDir( projectDir ) )
+ {
+ System.err.println( "Unable to remove file. Why???" );
+ }
+ assertThat( projectDir.exists(), equalTo( false ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/NullProjectCreatorTest.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/NullProjectCreatorTest.java b/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/NullProjectCreatorTest.java
new file mode 100644
index 0000000..45f66fb
--- /dev/null
+++ b/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/NullProjectCreatorTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.zest.tools.shell.create.project;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.zest.tools.shell.FileUtils;
+import org.apache.zest.tools.shell.TestHelper;
+import org.junit.Test;
+
+import static org.apache.zest.tools.shell.FileUtils.removeDir;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+
+public class NullProjectCreatorTest
+{
+ private NullProjectCreator underTest = new NullProjectCreator();
+
+ @Test
+ public void givenCorrectInputWhenCreatedProjectExpectCompleteProjectCreated()
+ throws Exception
+ {
+
+ TestHelper.zetZestZome();
+ File projectDir = new File( "ZestTest" );
+ if( projectDir.exists() )
+ {
+ removeDir( projectDir );
+ }
+ Map<String, String> properties = new HashMap<>();
+ properties.put( "zest.home", System.getProperty( "zest.home" ) );
+ properties.put( "root.package", "org.apache.zest.test" );
+ properties.put( "template.dir", "etc/templates/null/files" );
+ underTest.create( "ZestTest", projectDir, properties );
+
+ assertThat( projectDir.exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "src/main/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "gradlew" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "gradlew.bat" ).exists(), equalTo( true ) );
+ assertThat( new File( projectDir, "build.gradle" ).exists(), equalTo( true ) );
+ if( FileUtils.removeDir( projectDir ) )
+ {
+ System.err.println( "Unable to remove file. Why???" );
+ }
+ assertThat( projectDir.exists(), equalTo( false ) );
+ }
+}