ZEST-143 - Various fixes.
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/fe4932ff Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/fe4932ff Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/fe4932ff Branch: refs/heads/develop Commit: fe4932ffcdae4a5e73a65ed75382004282e1bd9f Parents: 8f25f13 Author: Niclas Hedhman <[email protected]> Authored: Fri Jun 10 06:24:19 2016 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Fri Jun 10 06:24:19 2016 +0800 ---------------------------------------------------------------------- .../etc/templates/default/template.properties | 24 +++ .../ng2-heroes/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/main/webapp/app/app.component.css | 34 ++++ .../app/src/main/webapp/app/app.component.ts | 37 +++++ .../src/main/webapp/app/dashboard.component.css | 67 ++++++++ .../main/webapp/app/dashboard.component.html | 15 ++ .../src/main/webapp/app/dashboard.component.ts | 31 ++++ .../main/webapp/app/hero-detail.component.css | 36 ++++ .../main/webapp/app/hero-detail.component.html | 16 ++ .../main/webapp/app/hero-detail.component.ts | 34 ++++ .../app/src/main/webapp/app/hero.service.ts | 22 +++ .../files/app/src/main/webapp/app/hero.ts | 11 ++ .../src/main/webapp/app/heroes.component.css | 66 ++++++++ .../src/main/webapp/app/heroes.component.html | 21 +++ .../app/src/main/webapp/app/heroes.component.ts | 39 +++++ .../files/app/src/main/webapp/app/main.ts | 16 ++ .../app/src/main/webapp/app/mock-heroes.ts | 21 +++ .../files/app/src/main/webapp/index.html | 41 +++++ .../files/app/src/main/webapp/styles.css | 149 +++++++++++++++++ .../app/src/test/java/__package__/package.html | 21 +++ .../ng2-heroes/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 + .../templates/ng2-heroes/files/build.gradle_ | 24 +++ .../files/gradle/wrapper/gradle-wrapper.jar_ | Bin 0 -> 51348 bytes .../gradle/wrapper/gradle-wrapper.properties_ | 6 + .../etc/templates/ng2-heroes/files/gradlew.bat_ | 90 ++++++++++ .../etc/templates/ng2-heroes/files/gradlew_ | 164 +++++++++++++++++++ .../ng2-heroes/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 + .../ng2-heroes/files/rest/build.gradle_ | 8 + .../__package__/rest/security/package.html_ | 1 + .../rest/src/main/resources/___placeholder___ | 0 .../src/test/java/__package__/package.html_ | 1 + .../templates/ng2-heroes/template.properties | 24 +++ .../dist/etc/templates/null/template.properties | 25 +++ .../etc/templates/restapp/template.properties | 23 +++ .../etc/templates/singleton/template.properties | 24 +++ .../org/apache/zest/tools/shell/FileUtils.java | 24 ++- .../zest/tools/shell/create/CreateProject.java | 3 +- .../create/project/AbstractProjectCreator.java | 2 +- .../create/project/HeroesProjectCreator.java | 86 ++++++++++ .../create/project/RestProjectCreator.java | 12 +- .../create/project/restapp/IndexHtmlWriter.java | 9 +- .../project/restapp/OrderModuleWriter.java | 89 ++++++++++ .../templates/default/project.properties | 24 --- .../resources/templates/null/project.properties | 25 --- .../templates/restapp/project.properties | 23 --- .../templates/singleton/project.properties | 24 --- .../apache/zest/tools/shell/FileUtilsTest.java | 4 +- 60 files changed, 1372 insertions(+), 118 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/default/template.properties ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/default/template.properties b/tools/shell/src/dist/etc/templates/default/template.properties new file mode 100644 index 0000000..e66c148 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/default/template.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. +# +# +# + + +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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/build.gradle_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/build.gradle_ new file mode 100644 index 0000000..5a19653 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/java/__package__/app/package.html ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/java/__package__/app/package.html b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/java/__package__/app/package.html new file mode 100644 index 0000000..1f859fb --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/resources/___placeholder___ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/resources/___placeholder___ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/resources/___placeholder___ new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/WEB-INF/___placeholder___ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/WEB-INF/___placeholder___ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/app.component.css ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/app.component.css b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/app.component.css new file mode 100755 index 0000000..cb651f5 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/app.component.css @@ -0,0 +1,34 @@ +nav a { + padding: 5px 10px; + text-decoration: none; + margin-top: 10px; + display: inline-block; + background-color: #eee; + border-radius: 4px; +} +nav a:visited, a:link { + color: #607D8B; +} +nav a:hover { + color: #039be5; + background-color: #CFD8DC; +} +nav a.router-link-active { + color: #039be5; +} +h1 { + font-size: 1.2em; + color: #999; + margin-bottom: 0; +} +h2 { + font-size: 2em; + margin-top: 0; + padding-top: 0; +} + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/app.component.ts ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/app.component.ts b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/app.component.ts new file mode 100755 index 0000000..222874b --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/app.component.ts @@ -0,0 +1,37 @@ +import {Component} from 'angular2/core'; +import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router'; +import {HeroesComponent} from './heroes.component'; +import {HeroDetailComponent} from './hero-detail.component'; +import {DashboardComponent} from './dashboard.component'; +import {HeroService} from './hero.service'; + +@Component({ + selector: 'my-app', + template: ` + <h1>{{title}}</h1> + <nav> + <a [routerLink]="['Dashboard']">Dashboard</a> + <a [routerLink]="['Heroes']">Heroes</a> + </nav> + <router-outlet></router-outlet> + `, + styleUrls: ['app/app.component.css'], + directives: [ROUTER_DIRECTIVES], + providers: [HeroService] +}) +@RouteConfig([ + // {path: '/', redirectTo: ['Dashboard'] }, + {path: '/dashboard', name: 'Dashboard', component: DashboardComponent, useAsDefault: true}, + {path: '/heroes', name: 'Heroes', component: HeroesComponent}, + {path: '/detail/:id', name: 'HeroDetail', component: HeroDetailComponent} +]) +export class AppComponent { + title = 'Tour of Heroes'; +} + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.css ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.css b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.css new file mode 100755 index 0000000..b9d3215 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.css @@ -0,0 +1,67 @@ +[class*='col-'] { + float: left; +} +*, *:after, *:before { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +h3 { + text-align: center; margin-bottom: 0; +} +[class*='col-'] { + padding-right: 20px; + padding-bottom: 20px; +} +[class*='col-']:last-of-type { + padding-right: 0; +} +.grid { + margin: 0; +} +.col-1-4 { + width: 25%; +} +.module { + padding: 20px; + text-align: center; + color: #eee; + max-height: 120px; + min-width: 120px; + background-color: #607D8B; + border-radius: 2px; +} +h4 { + position: relative; +} +.module:hover { + background-color: #EEE; + cursor: pointer; + color: #607d8b; +} +.grid-pad { + padding: 10px 0; +} +.grid-pad > [class*='col-']:last-of-type { + padding-right: 20px; +} +@media (max-width: 600px) { + .module { + font-size: 10px; + max-height: 75px; } +} +@media (max-width: 1024px) { + .grid { + margin: 0; + } + .module { + min-width: 60px; + } +} + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.html ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.html b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.html new file mode 100755 index 0000000..3fc7517 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.html @@ -0,0 +1,15 @@ +<h3>Top Heroes</h3> +<div class="grid grid-pad"> + <div *ngFor="#hero of heroes" class="col-1-4" (click)="gotoDetail(hero)"> + <div class="module hero"> + <h4>{{hero.name}}</h4> + </div> + </div> +</div> + + +<!-- +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +--> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.ts ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.ts b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.ts new file mode 100755 index 0000000..c8160d1 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/dashboard.component.ts @@ -0,0 +1,31 @@ +import {Component, OnInit} from 'angular2/core'; +import {Router} from 'angular2/router'; +import {Hero} from './hero'; +import {HeroService} from './hero.service'; + +@Component({ + selector: 'my-dashboard', + templateUrl: 'app/dashboard.component.html', + styleUrls: ['app/dashboard.component.css'] +}) +export class DashboardComponent implements OnInit { + heroes: Hero[] = []; + + constructor(private _heroService: HeroService, private _router: Router) { } + + ngOnInit() { + this._heroService.getHeroes().then(heroes => this.heroes = heroes.slice(1,5)); + } + + gotoDetail(hero: Hero) { + let link = ['HeroDetail', { id: hero.id }]; + this._router.navigate(link); + } +} + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.css ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.css b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.css new file mode 100755 index 0000000..2a0e285 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.css @@ -0,0 +1,36 @@ +label { + display: inline-block; + width: 3em; + margin: .5em 0; + color: #607D8B; + font-weight: bold; +} +input { + height: 2em; + font-size: 1em; + padding-left: .4em; +} +button { + margin-top: 20px; + font-family: Arial; + background-color: #eee; + border: none; + padding: 5px 10px; + border-radius: 4px; + cursor: pointer; cursor: hand; +} +button:hover { + background-color: #cfd8dc; +} +button:disabled { + background-color: #eee; + color: #ccc; + cursor: auto; +} + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.html ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.html b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.html new file mode 100755 index 0000000..1e85e75 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.html @@ -0,0 +1,16 @@ +<div *ngIf="hero"> + <h2>{{hero.name}} details!</h2> + <div> + <label>id: </label>{{hero.id}}</div> + <div> + <label>name: </label> + <input [(ngModel)]="hero.name" placeholder="name"/> + </div> + <button (click)="goBack()">Back</button> +</div> + +<!-- +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +--> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.ts ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.ts b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.ts new file mode 100755 index 0000000..0181847 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero-detail.component.ts @@ -0,0 +1,34 @@ +import {Component, OnInit} from 'angular2/core'; +import {RouteParams} from 'angular2/router'; + +import {Hero} from './hero'; +import {HeroService} from './hero.service'; + +@Component({ + selector: 'my-hero-detail', + templateUrl: 'app/hero-detail.component.html', + styleUrls: ['app/hero-detail.component.css'] +}) +export class HeroDetailComponent implements OnInit { + hero: Hero; + + constructor(private _heroService: HeroService, + private _routeParams: RouteParams) { + } + + ngOnInit() { + let id = +this._routeParams.get('id'); + this._heroService.getHero(id).then(hero => this.hero = hero); + } + + goBack() { + window.history.back(); + } +} + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero.service.ts ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero.service.ts b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero.service.ts new file mode 100755 index 0000000..aee78a1 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero.service.ts @@ -0,0 +1,22 @@ +import {Injectable} from 'angular2/core'; +import {HEROES} from './mock-heroes'; + +@Injectable() +export class HeroService { + getHeroes() { + return Promise.resolve(HEROES); + } + + getHero(id: number) { + return Promise.resolve(HEROES).then( + heroes => heroes.filter(hero => hero.id === id)[0] + ); + } +} + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero.ts ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero.ts b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero.ts new file mode 100755 index 0000000..812726c --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/hero.ts @@ -0,0 +1,11 @@ +export class Hero { + id: number; + name: string; +} + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.css ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.css b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.css new file mode 100755 index 0000000..98e7ecc --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.css @@ -0,0 +1,66 @@ +.selected { + background-color: #CFD8DC !important; + color: white; +} +.heroes { + margin: 0 0 2em 0; + list-style-type: none; + padding: 0; + width: 15em; +} +.heroes li { + cursor: pointer; + position: relative; + left: 0; + background-color: #EEE; + margin: .5em; + padding: .3em 0; + height: 1.6em; + border-radius: 4px; +} +.heroes li:hover { + color: #607D8B; + background-color: #DDD; + left: .1em; +} +.heroes li.selected:hover { + background-color: #BBD8DC !important; + color: white; +} +.heroes .text { + position: relative; + top: -3px; +} +.heroes .badge { + display: inline-block; + font-size: small; + color: white; + padding: 0.8em 0.7em 0 0.7em; + background-color: #607D8B; + line-height: 1em; + position: relative; + left: -1px; + top: -4px; + height: 1.8em; + margin-right: .8em; + border-radius: 4px 0 0 4px; +} +button { + font-family: Arial; + background-color: #eee; + border: none; + padding: 5px 10px; + border-radius: 4px; + cursor: pointer; + cursor: hand; +} +button:hover { + background-color: #cfd8dc; +} + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.html ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.html b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.html new file mode 100755 index 0000000..0688e6a --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.html @@ -0,0 +1,21 @@ +<div> + <h2>My Heroes</h2> + <ul class="heroes"> + <li *ngFor="#hero of heroes" + [class.selected]="hero === selectedHero" + (click)="onSelect(hero)"> + <span class="badge">{{hero.id}}</span> {{hero.name}} + </li> + </ul> + <div *ngIf="selectedHero"> + <h2>{{selectedHero.name | uppercase}} is my hero</h2> + <button (click)="gotoDetail()">View Details</button> + </div> +</div> + + +<!-- +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +--> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.ts ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.ts b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.ts new file mode 100755 index 0000000..0002025 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/heroes.component.ts @@ -0,0 +1,39 @@ +import {Component, OnInit} from 'angular2/core'; +import {Router} from 'angular2/router'; +import {HeroService} from './hero.service'; +import {HeroDetailComponent} from './hero-detail.component'; +import {Hero} from './hero'; + +@Component({ + selector: 'my-heroes', + templateUrl: 'app/heroes.component.html', + styleUrls: ['app/heroes.component.css'], + directives: [HeroDetailComponent] +}) +export class HeroesComponent implements OnInit { + heroes: Hero[]; + selectedHero: Hero; + + constructor(private _heroService: HeroService, private _router: Router) { } + + getHeroes() { + this._heroService.getHeroes().then(heroes => this.heroes = heroes); + } + + gotoDetail() { + this._router.navigate(['HeroDetail', { id: this.selectedHero.id }]); + } + + ngOnInit() { + this.getHeroes(); + } + + onSelect(hero: Hero) { this.selectedHero = hero; } +} + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/main.ts ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/main.ts b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/main.ts new file mode 100755 index 0000000..95e2d0b --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/main.ts @@ -0,0 +1,16 @@ +import {bootstrap} from 'angular2/platform/browser'; +import {ROUTER_PROVIDERS} from 'angular2/router'; +import {HeroService} from './hero.service'; +import {AppComponent} from './app.component'; + +bootstrap(AppComponent, [ + ROUTER_PROVIDERS, + HeroService +]); + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/mock-heroes.ts ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/mock-heroes.ts b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/mock-heroes.ts new file mode 100755 index 0000000..673cf53 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/app/mock-heroes.ts @@ -0,0 +1,21 @@ +import { Hero } from './hero'; + +export var HEROES: Hero[] = [ + {"id": 11, "name": "Mr. Nice"}, + {"id": 12, "name": "Narco"}, + {"id": 13, "name": "Bombasto"}, + {"id": 14, "name": "Celeritas"}, + {"id": 15, "name": "Magneta"}, + {"id": 16, "name": "RubberMan"}, + {"id": 17, "name": "Dynama"}, + {"id": 18, "name": "Dr IQ"}, + {"id": 19, "name": "Magma"}, + {"id": 20, "name": "Tornado"} +]; + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/index.html ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/index.html b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/index.html new file mode 100755 index 0000000..753dd48 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/index.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html> + <head> + <script>document.write('<base href="' + document.location + '" />');</script> + <title>Angular 2 Tour of Heroes</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="stylesheet" href="styles.css"> + + <!-- IE required polyfills, in this exact order --> + <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.0/es6-shim.min.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.26/system-polyfills.js"></script> + <script src="https://npmcdn.com/[email protected]/es6/dev/src/testing/shims_for_IE.js"></script> + + <script src="https://code.angularjs.org/2.0.0-beta.15/angular2-polyfills.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.26/system.js"></script> + <script src="https://npmcdn.com/[email protected]/lib/typescript.js"></script> + <script src="https://code.angularjs.org/2.0.0-beta.15/Rx.js"></script> + <script src="https://code.angularjs.org/2.0.0-beta.15/angular2.dev.js"></script> + <script src="https://code.angularjs.org/2.0.0-beta.15/router.dev.js"></script> + <script> + System.config({ + transpiler: 'typescript', + typescriptOptions: { emitDecoratorMetadata: true }, + packages: {'app': {defaultExtension: 'ts'}} + }); + System.import('app/main') + .then(null, console.error.bind(console)); + </script> + </head> + + <body> + <my-app>Loading...</my-app> + </body> +</html> + + +<!-- +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +--> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/styles.css ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/styles.css b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/styles.css new file mode 100755 index 0000000..1774fd6 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/main/webapp/styles.css @@ -0,0 +1,149 @@ +/* Master Styles */ +h1 { + color: #369; + font-family: Arial, Helvetica, sans-serif; + font-size: 250%; +} +h2, h3 { + color: #444; + font-family: Arial, Helvetica, sans-serif; + font-weight: lighter; +} +body { + margin: 2em; +} +body, input[text], button { + color: #888; + font-family: Cambria, Georgia; +} +a { + cursor: pointer; + cursor: hand; +} +button { + font-family: Arial; + background-color: #eee; + border: none; + padding: 5px 10px; + border-radius: 4px; + cursor: pointer; + cursor: hand; +} +button:hover { + background-color: #cfd8dc; +} +button:disabled { + background-color: #eee; + color: #aaa; + cursor: auto; +} + +/* Navigation link styles */ +nav a { + padding: 5px 10px; + text-decoration: none; + margin-top: 10px; + display: inline-block; + background-color: #eee; + border-radius: 4px; +} +nav a:visited, a:link { + color: #607D8B; +} +nav a:hover { + color: #039be5; + background-color: #CFD8DC; +} +nav a.router-link-active { + color: #039be5; +} + +/* items class */ +.items { + margin: 0 0 2em 0; + list-style-type: none; + padding: 0; + width: 24em; +} +.items li { + cursor: pointer; + position: relative; + left: 0; + background-color: #EEE; + margin: .5em; + padding: .3em 0; + height: 1.6em; + border-radius: 4px; +} +.items li:hover { + color: #607D8B; + background-color: #DDD; + left: .1em; +} +.items li.selected:hover { + background-color: #BBD8DC; + color: white; +} +.items .text { + position: relative; + top: -3px; +} +.items { + margin: 0 0 2em 0; + list-style-type: none; + padding: 0; + width: 24em; +} +.items li { + cursor: pointer; + position: relative; + left: 0; + background-color: #EEE; + margin: .5em; + padding: .3em 0; + height: 1.6em; + border-radius: 4px; +} +.items li:hover { + color: #607D8B; + background-color: #DDD; + left: .1em; +} +.items li.selected { + background-color: #CFD8DC; + color: white; +} + +.items li.selected:hover { + background-color: #BBD8DC; +} +.items .text { + position: relative; + top: -3px; +} +.items .badge { + display: inline-block; + font-size: small; + color: white; + padding: 0.8em 0.7em 0 0.7em; + background-color: #607D8B; + line-height: 1em; + position: relative; + left: -1px; + top: -4px; + height: 1.8em; + margin-right: .8em; + border-radius: 4px 0 0 4px; +} + +/* everywhere else */ +* { + font-family: Arial, Helvetica, sans-serif; +} + + +/* +Copyright 2016 Google Inc. All Rights Reserved. +Use of this source code is governed by an MIT-style license that +can be found in the LICENSE file at http://angular.io/license +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/test/java/__package__/package.html ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/test/java/__package__/package.html b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/src/test/java/__package__/package.html new file mode 100644 index 0000000..8bb0a631 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_ new file mode 100644 index 0000000..f26f7f8 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_ new file mode 100644 index 0000000..e4bffa5 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_ new file mode 100644 index 0000000..21dbaa9 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_ new file mode 100644 index 0000000..2bdc426 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_ new file mode 100644 index 0000000..cf2f9b5 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/resources/___placeholder___ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/resources/___placeholder___ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/main/resources/___placeholder___ new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/test/java/__package__/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/test/java/__package__/package.html_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/src/test/java/__package__/package.html_ new file mode 100644 index 0000000..300838d --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/build.gradle_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/build.gradle_ new file mode 100644 index 0000000..3d5b366 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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() + 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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradle/wrapper/gradle-wrapper.jar_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradle/wrapper/gradle-wrapper.jar_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradle/wrapper/gradle-wrapper.jar_ new file mode 100644 index 0000000..0087cd3 Binary files /dev/null and b/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradle/wrapper/gradle-wrapper.jar_ differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradle/wrapper/gradle-wrapper.properties_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradle/wrapper/gradle-wrapper.properties_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradle/wrapper/gradle-wrapper.properties_ new file mode 100644 index 0000000..fafa8dd --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradlew.bat_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradlew.bat_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradlew.bat_ new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradlew_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradlew_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/gradlew_ new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/build.gradle_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/build.gradle_ new file mode 100644 index 0000000..83f55b2 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/main/java/__package__/model/orders/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/main/java/__package__/model/orders/package.html_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/main/java/__package__/model/orders/package.html_ new file mode 100644 index 0000000..441cb85 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/main/java/__package__/model/security/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/main/java/__package__/model/security/package.html_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/main/java/__package__/model/security/package.html_ new file mode 100644 index 0000000..bcf0ee4 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/main/resources/___placeholder___ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/main/resources/___placeholder___ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/main/resources/___placeholder___ new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/test/java/__package__/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/test/java/__package__/package.html_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/model/src/test/java/__package__/package.html_ new file mode 100644 index 0000000..300838d --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/build.gradle_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/build.gradle_ new file mode 100644 index 0000000..a89355a --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/src/main/java/__package__/rest/security/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/src/main/java/__package__/rest/security/package.html_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/src/main/java/__package__/rest/security/package.html_ new file mode 100644 index 0000000..249f68c --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/src/main/resources/___placeholder___ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/src/main/resources/___placeholder___ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/src/main/resources/___placeholder___ new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/src/test/java/__package__/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/src/test/java/__package__/package.html_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/src/test/java/__package__/package.html_ new file mode 100644 index 0000000..300838d --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/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/fe4932ff/tools/shell/src/dist/etc/templates/ng2-heroes/template.properties ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/template.properties b/tools/shell/src/dist/etc/templates/ng2-heroes/template.properties new file mode 100644 index 0000000..5927c9d --- /dev/null +++ b/tools/shell/src/dist/etc/templates/ng2-heroes/template.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. +# +# +# + + +creator.class=org.apache.zest.tools.shell.create.project.HeroesProjectCreator + +template.dir=etc/templates/ng2-heroes/files \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/null/template.properties ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/null/template.properties b/tools/shell/src/dist/etc/templates/null/template.properties new file mode 100644 index 0000000..d26b377 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/null/template.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/fe4932ff/tools/shell/src/dist/etc/templates/restapp/template.properties ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/restapp/template.properties b/tools/shell/src/dist/etc/templates/restapp/template.properties new file mode 100644 index 0000000..5e78fd6 --- /dev/null +++ b/tools/shell/src/dist/etc/templates/restapp/template.properties @@ -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. +# +# +# + +creator.class=org.apache.zest.tools.shell.create.project.RestProjectCreator + +template.dir=etc/templates/restapp/files \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/dist/etc/templates/singleton/template.properties ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/etc/templates/singleton/template.properties b/tools/shell/src/dist/etc/templates/singleton/template.properties new file mode 100644 index 0000000..d504d1d --- /dev/null +++ b/tools/shell/src/dist/etc/templates/singleton/template.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/fe4932ff/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 e0e6afa..868d2eb 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 @@ -67,11 +67,10 @@ public class FileUtils return success; } - public static Map<String, String> readPropertiesResource( String resourceName ) + public static Map<String, String> readTemplateProperties( String templateName ) { - ClassLoader cl = FileUtils.class.getClassLoader(); - InputStream in = cl.getResourceAsStream( resourceName ); - try + File propertiesFile = new File( zestHome(), "etc/templates/" + templateName + "/template.properties" ); + try (InputStream in = new BufferedInputStream( new FileInputStream( propertiesFile ) )) { Properties properties = readProperties( in ); Map<String, String> result = new HashMap<String, String>(); @@ -83,9 +82,9 @@ public class FileUtils } catch( Exception e ) { - System.err.println( "Unable to read resource " + resourceName ); - System.exit( 2 ); - return null; + String message = "Unable to read template \'" + templateName + "\'."; + System.err.println( message ); + throw new RuntimeException( message ); } } @@ -116,6 +115,12 @@ public class FileUtils } } + public static File zestHome() + { + String home = System.getProperty( "zest.home" ); + return new File( home ).getAbsoluteFile(); + } + public static PrintWriter createJavaClassPrintWriter( Map<String, String> properties, String module, String packagename, @@ -133,12 +138,13 @@ public class FileUtils } } final File destination = new File( packageDir, classname + ".java" ); - return new PrintWriter( new FileWriter( destination ) ){ + return new PrintWriter( new FileWriter( destination ) ) + { @Override public void close() { super.close(); - System.out.println("Creating " + destination ); + System.out.println( "Creating " + destination ); } }; } http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/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 15368c8..aa0691e 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 @@ -43,7 +43,7 @@ public class CreateProject extends AbstractCommand String projectName = args[ 2 ]; String rootPackage = args[ 3 ]; File projectDir = FileUtils.createDir( projectName ); - Map<String, String> props = FileUtils.readPropertiesResource( "templates/" + template + "/project.properties" ); + Map<String, String> props = FileUtils.readTemplateProperties( template ); if( props == null ) { System.err.println( "Project Template " + template + " does not exist. \n\n" ); @@ -53,7 +53,6 @@ public class CreateProject extends AbstractCommand props.put( "project.name", projectName); props.put( "template", template); props.put( "root.package", rootPackage); - props.put( "zest.home", System.getProperty( "zest.home" ) ); String classname = props.get( "creator.class" ); try { http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/AbstractProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/AbstractProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/AbstractProjectCreator.java index e6f49aa..b6c7b9f 100644 --- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/AbstractProjectCreator.java +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/AbstractProjectCreator.java @@ -39,7 +39,7 @@ abstract class AbstractProjectCreator ) throws IOException { - File templateDir = new File( properties.get( "zest.home" ), properties.get( "template.dir" ) ); + File templateDir = new File( FileUtils.zestHome(), properties.get( "template.dir" ) ); copyFiles( templateDir, projectDir, properties.get( "root.package" ) ); File gradlewFile = new File( projectDir, "gradlew" ); Path gradlewPath = gradlewFile.toPath(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/HeroesProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/HeroesProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/HeroesProjectCreator.java new file mode 100644 index 0000000..b2e3e94 --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/HeroesProjectCreator.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; + +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.StorageModuleWriter; +import org.apache.zest.tools.shell.create.project.restapp.ApplicationWriter; +import org.apache.zest.tools.shell.create.project.restapp.IndexHtmlWriter; +import org.apache.zest.tools.shell.create.project.restapp.RestModuleWriter; +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.WebXmlWriter; + +public class HeroesProjectCreator 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 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 SettingsWriter().writeClass( properties ); + new IndexHtmlWriter().writeClass( properties ); + new WebXmlWriter().writeClass( properties ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/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 index b537a57..8eb70ec 100644 --- 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 @@ -24,7 +24,6 @@ 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; @@ -37,15 +36,17 @@ 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.StorageModuleWriter; +import org.apache.zest.tools.shell.create.project.restapp.ApplicationWriter; +import org.apache.zest.tools.shell.create.project.restapp.IndexHtmlWriter; +import org.apache.zest.tools.shell.create.project.restapp.OrderModuleWriter; +import org.apache.zest.tools.shell.create.project.restapp.RestModuleWriter; 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.common.StorageModuleWriter; import org.apache.zest.tools.shell.create.project.restapp.WebXmlWriter; public class RestProjectCreator extends AbstractProjectCreator @@ -66,7 +67,6 @@ public class RestProjectCreator extends AbstractProjectCreator 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 ); @@ -82,7 +82,9 @@ public class RestProjectCreator extends AbstractProjectCreator new OrderItemWriter().writeClass( properties ); new CustomerWriter().writeClass( properties ); + new OrderModuleWriter().writeClass( properties ); new SettingsWriter().writeClass( properties ); + new IndexHtmlWriter().writeClass( properties ); new WebXmlWriter().writeClass( properties ); } } http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/IndexHtmlWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/IndexHtmlWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/IndexHtmlWriter.java index a2143b5..0d65026 100644 --- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/IndexHtmlWriter.java +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/IndexHtmlWriter.java @@ -39,10 +39,13 @@ public class IndexHtmlWriter pw.println( String.format( "<!DOCTYPE html>\n" + - "<html><body>\n" + - "<h1>Welcome to %s</h1>" + + "<html>\n" + + "<head>\n" + + "</head>\n" + + "<body>\n" + + "<h1>Welcome to %s</h1>\n" + "</body></html>\n" + - "<>\n", projectName ) + "\n", projectName ) ); } } http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/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 new file mode 100644 index 0000000..3bf9c1f --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/restapp/OrderModuleWriter.java @@ -0,0 +1,89 @@ +/* + * 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.IOException; +import java.io.PrintWriter; +import java.util.Map; +import org.apache.zest.tools.shell.FileUtils; + +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;" + + "import org.apache.zest.library.restlet.assembly.RestletCrudModuleAssembler;"); + 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.withDefaultUnitOfWorkFactory();\n" + + " module.values( /* add value types */ );\n" + + " module.entities( /* add entity types */ );\n\n" + + " // These assemblers sets up CRUD access to the entity types listed.\n" + + " new RestletCrudModuleAssembler( Order.class ).assemble( module );\n" + + " new RestletCrudModuleAssembler( OrderItem.class ).assemble( module );\n" + + " new RestletCrudModuleAssembler( Customer.class ).assemble( module );\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"; + return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/fe4932ff/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 deleted file mode 100644 index e66c148..0000000 --- a/tools/shell/src/main/resources/templates/default/project.properties +++ /dev/null @@ -1,24 +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. -# -# -# - - -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/fe4932ff/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 deleted file mode 100644 index d26b377..0000000 --- a/tools/shell/src/main/resources/templates/null/project.properties +++ /dev/null @@ -1,25 +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. - - -# 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
