http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/Main.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/Main.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/Main.java deleted file mode 100644 index 5054b79..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/Main.java +++ /dev/null @@ -1,117 +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.polygene.tools.shell; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.util.Map; -import java.util.TreeMap; -import org.apache.polygene.tools.shell.create.CreateProject; -import org.apache.polygene.tools.shell.help.HelpCommand; - -public class Main -{ - private Map<String, Command> commands = new TreeMap<>(); - - public static void main( String[] args ) - { - new Main().run( args ); - } - - private Main() - { - HelpCommand helpCommand = new HelpCommand(); - addCommand( helpCommand ); - addCommand( new CreateProject() ); - helpCommand.setCommands( commands.values() ); - } - - private void addCommand( Command command ) - { - commands.put( command.name(), command ); - } - - private void run( String[] args ) - { - if( !contains( args, "-q" ) ) - { - System.out.println( "\n\nPolygene - Classes are Dead. Long Live Interfaces!" ); - System.out.println( "----------------------------------------------\n" ); - } - if( args.length == 0 ) - { - commands.get( "help" ).execute( args, input(), error() ); - } - else - { - try - { - executeCommand( args ); - } - catch( HelpNeededException e ) - { - 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 ) - { - if( s.equals( arg ) ) - { - return true; - } - } - return false; - } - - private PrintWriter error() - { - return new PrintWriter( System.err ); - } - - private PrintWriter output() - { - return new PrintWriter( System.out ); - } - - private BufferedReader input() - { - return new BufferedReader( new InputStreamReader( System.in ) ); - } -}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/CreateProject.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/CreateProject.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/CreateProject.java deleted file mode 100644 index 57b186c..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/CreateProject.java +++ /dev/null @@ -1,80 +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.polygene.tools.shell.create; - -import java.io.BufferedReader; -import java.io.File; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.AbstractCommand; -import org.apache.polygene.tools.shell.FileUtils; -import org.apache.polygene.tools.shell.HelpNeededException; -import org.apache.polygene.tools.shell.create.project.ProjectCreator; - -public class CreateProject extends AbstractCommand -{ - - @Override - public void execute( String[] args, BufferedReader input, PrintWriter output ) - throws HelpNeededException - { - if( args.length != 4 ) - { - throw new HelpNeededException(); - } - String template = args[ 1 ]; - String projectName = args[ 2 ]; - String rootPackage = args[ 3 ]; - File projectDir = FileUtils.createDir( projectName ); - Map<String, String> props = FileUtils.readTemplateProperties( template ); - if( props == null ) - { - 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); - props.put( "template", template); - props.put( "root.package", rootPackage); - String classname = props.get( "creator.class" ); - try - { - ProjectCreator creator = (ProjectCreator) Class.forName( classname ).newInstance(); - creator.create( args[ 0 ], projectDir, props ); - } - catch( Exception e ) - { - e.printStackTrace(); - throw new RuntimeException( "Unable to create the Project Creator." ); - } - } - - @Override - public String description() - { - return "type name package\tCreates a new skeletal project in directory [name]."; - } - - @Override - public String name() - { - return "create-project"; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/AbstractProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/AbstractProjectCreator.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/AbstractProjectCreator.java deleted file mode 100644 index 66f7c40..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/AbstractProjectCreator.java +++ /dev/null @@ -1,106 +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.polygene.tools.shell.create.project; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.attribute.PosixFilePermissions; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -abstract class AbstractProjectCreator - implements ProjectCreator -{ - - @Override - public void create( String projectName, - File projectDir, - Map<String, String> properties - ) - throws IOException - { - File templateDir = new File( FileUtils.polygeneHome(), properties.get( "template.dir" ) ); - copyFiles( templateDir, projectDir, properties.get( "root.package" ) ); - File gradlewFile = new File( projectDir, "gradlew" ); - Path gradlewPath = gradlewFile.toPath(); - setGradlewPermissions( gradlewFile, gradlewPath ); - } - - private void copyFiles( File fromDir, File toDir, String rootpackage ) - throws IOException - { - File[] files = fromDir.listFiles(); - if( files == null ) - { - return; - } - Files.createDirectories( toDir.toPath() ); - for( File f : files ) - { - String filename = f.getName(); - if( f.isDirectory() ) - { - if( filename.equals( "__package__" ) ) - { - toDir = new File( toDir, rootpackage.replaceAll( "\\.", "/" ) ); - copyFiles( f, toDir, rootpackage ); - } - else - { - copyFiles( f, new File( toDir, filename ), rootpackage ); - } - } - if( f.isFile() ) - { - if( !filename.equals( "___placeholder___" ) ) // skip these files that are needed for GIT. - { - if( filename.endsWith( "_" ) ) - { - filename = filename.substring( 0, filename.length() - 1 ); - } - File dest = new File( toDir, filename ); - FileUtils.copyFile( f, dest ); - } - } - } - } - - private void setGradlewPermissions( File gradlewFile, Path gradlewPath ) - throws IOException - { - try - { - if( gradlewFile.exists() ) - { - Files.setPosixFilePermissions( gradlewPath, PosixFilePermissions.fromString( "rwxr-xr-x" ) ); - } - } - catch( Exception e ) - { - if( !System.getProperty( "os.name" ).contains( "Windows" ) ) - { - throw new IOException( "Unable to set file permissions on " + gradlewPath.toString(), e ); - } - } - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/DefaultProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/DefaultProjectCreator.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/DefaultProjectCreator.java deleted file mode 100644 index f5ca030..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/DefaultProjectCreator.java +++ /dev/null @@ -1,79 +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.polygene.tools.shell.create.project; - -import java.io.File; -import java.io.IOException; -import java.util.Map; -import org.apache.polygene.tools.shell.create.project.common.ApplicationAssemblerWriter; -import org.apache.polygene.tools.shell.create.project.common.ConfigLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.ConfigModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.ConnectivityLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.CrudModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.CustomerWriter; -import org.apache.polygene.tools.shell.create.project.common.DomainLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.FileConfigurationModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.HardCodedSecurityRepositoryMixinWriter; -import org.apache.polygene.tools.shell.create.project.common.IndexingModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.InfrastructureLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.OrderItemWriter; -import org.apache.polygene.tools.shell.create.project.common.OrderModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.OrderWriter; -import org.apache.polygene.tools.shell.create.project.common.SecurityModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.SecurityRepositoryWriter; -import org.apache.polygene.tools.shell.create.project.common.SerializationModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.StorageModuleWriter; -import org.apache.polygene.tools.shell.create.project.defaultp.ApplicationWriter; -import org.apache.polygene.tools.shell.create.project.defaultp.SettingsWriter; - -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/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/HeroesProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/HeroesProjectCreator.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/HeroesProjectCreator.java deleted file mode 100644 index b7ca22e..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/HeroesProjectCreator.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.polygene.tools.shell.create.project; - -import java.io.File; -import java.io.IOException; -import java.util.Map; -import org.apache.polygene.tools.shell.create.project.common.ApplicationAssemblerWriter; -import org.apache.polygene.tools.shell.create.project.common.ConfigLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.ConfigModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.ConnectivityLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.CrudModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.DomainLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.FileConfigurationModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.HardCodedSecurityRepositoryMixinWriter; -import org.apache.polygene.tools.shell.create.project.common.IndexingModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.InfrastructureLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.SecurityModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.SecurityRepositoryWriter; -import org.apache.polygene.tools.shell.create.project.common.SerializationModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.StorageModuleWriter; -import org.apache.polygene.tools.shell.create.project.restapp.ApplicationWriter; -import org.apache.polygene.tools.shell.create.project.restapp.IndexHtmlWriter; -import org.apache.polygene.tools.shell.create.project.restapp.RestModuleWriter; -import org.apache.polygene.tools.shell.create.project.restapp.SettingsWriter; -import org.apache.polygene.tools.shell.create.project.restapp.SimpleEnrolerWriter; -import org.apache.polygene.tools.shell.create.project.restapp.SimpleVerifierWriter; -import org.apache.polygene.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/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/ProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/ProjectCreator.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/ProjectCreator.java deleted file mode 100644 index c4cee69..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/ProjectCreator.java +++ /dev/null @@ -1,34 +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.polygene.tools.shell.create.project; - -import java.io.File; -import java.io.IOException; -import java.util.Map; - -public interface ProjectCreator -{ - void create( String projectName, - File projectDir, - Map<String, String> properties - ) - throws IOException; -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/RestProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/RestProjectCreator.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/RestProjectCreator.java deleted file mode 100644 index 78d3aef..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/RestProjectCreator.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.polygene.tools.shell.create.project; - -import java.io.File; -import java.io.IOException; -import java.util.Map; -import org.apache.polygene.tools.shell.create.project.common.ApplicationAssemblerWriter; -import org.apache.polygene.tools.shell.create.project.common.ConfigLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.ConfigModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.ConnectivityLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.CrudModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.CustomerWriter; -import org.apache.polygene.tools.shell.create.project.common.DomainLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.FileConfigurationModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.HardCodedSecurityRepositoryMixinWriter; -import org.apache.polygene.tools.shell.create.project.common.IndexingModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.InfrastructureLayerWriter; -import org.apache.polygene.tools.shell.create.project.common.OrderItemWriter; -import org.apache.polygene.tools.shell.create.project.common.OrderWriter; -import org.apache.polygene.tools.shell.create.project.common.SecurityModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.SecurityRepositoryWriter; -import org.apache.polygene.tools.shell.create.project.common.SerializationModuleWriter; -import org.apache.polygene.tools.shell.create.project.common.StorageModuleWriter; -import org.apache.polygene.tools.shell.create.project.restapp.ApplicationWriter; -import org.apache.polygene.tools.shell.create.project.restapp.IndexHtmlWriter; -import org.apache.polygene.tools.shell.create.project.restapp.OrderModuleWriter; -import org.apache.polygene.tools.shell.create.project.restapp.RestModuleWriter; -import org.apache.polygene.tools.shell.create.project.restapp.SettingsWriter; -import org.apache.polygene.tools.shell.create.project.restapp.SimpleEnrolerWriter; -import org.apache.polygene.tools.shell.create.project.restapp.SimpleVerifierWriter; -import org.apache.polygene.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 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 OrderModuleWriter().writeClass( properties ); - new SettingsWriter().writeClass( properties ); - new IndexHtmlWriter().writeClass( properties ); - new WebXmlWriter().writeClass( properties ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/SingletonProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/SingletonProjectCreator.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/SingletonProjectCreator.java deleted file mode 100644 index a4815a7..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/SingletonProjectCreator.java +++ /dev/null @@ -1,41 +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.polygene.tools.shell.create.project; - -import java.io.File; -import java.io.IOException; -import java.util.Map; -import org.apache.polygene.tools.shell.create.project.singleton.SettingsWriter; -import org.apache.polygene.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 ); - new SettingsWriter().writeClass( properties ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ApplicationAssemblerWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ApplicationAssemblerWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ApplicationAssemblerWriter.java deleted file mode 100644 index d5ba78e..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ApplicationAssemblerWriter.java +++ /dev/null @@ -1,100 +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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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(); - pw.println( "import org.apache.polygene.bootstrap.ApplicationAssembly;" ); - pw.println( "import org.apache.polygene.bootstrap.AssemblyException;" ); - pw.println( "import org.apache.polygene.bootstrap.LayerAssembly;" ); - pw.println( "import org.apache.polygene.bootstrap.ModuleAssembly;" ); - pw.println( "import org.apache.polygene.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( " LayerAssembly infraLayer = new InfrastructureLayer( configModule ).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"; - - return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigLayerWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigLayerWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigLayerWriter.java deleted file mode 100644 index 09dc0f6..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigLayerWriter.java +++ /dev/null @@ -1,79 +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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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.polygene.bootstrap.AssemblyException;\n" + - "import org.apache.polygene.bootstrap.LayerAssembly;\n" + - "import org.apache.polygene.bootstrap.ModuleAssembly;\n" + - "import org.apache.polygene.bootstrap.layered.LayerAssembler;\n" + - "import org.apache.polygene.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"; - return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigModuleWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigModuleWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigModuleWriter.java deleted file mode 100644 index 69a613a..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConfigModuleWriter.java +++ /dev/null @@ -1,73 +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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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.polygene.api.common.Visibility;\n" + - "import org.apache.polygene.bootstrap.AssemblyException;\n" + - "import org.apache.polygene.bootstrap.LayerAssembly;\n" + - "import org.apache.polygene.bootstrap.ModuleAssembly;\n" + - "import org.apache.polygene.bootstrap.layered.ModuleAssembler;\n" + - "import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;\n" + - "import org.apache.polygene.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" + - " 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"; - return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConnectivityLayerWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConnectivityLayerWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConnectivityLayerWriter.java deleted file mode 100644 index 40edec4..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/ConnectivityLayerWriter.java +++ /dev/null @@ -1,72 +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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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.polygene.bootstrap.AssemblyException;\n" + - "import org.apache.polygene.bootstrap.LayerAssembly;\n" + - "import org.apache.polygene.bootstrap.layered.LayerAssembler;\n" + - "import org.apache.polygene.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"; - return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/CrudModuleWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/CrudModuleWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/CrudModuleWriter.java deleted file mode 100644 index 15bf791..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/CrudModuleWriter.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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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.polygene.bootstrap.AssemblyException;\n" + - "import org.apache.polygene.bootstrap.LayerAssembly;\n" + - "import org.apache.polygene.bootstrap.ModuleAssembly;\n" + - "import org.apache.polygene.bootstrap.layered.ModuleAssembler;\n" + - "import org.apache.polygene.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" + - " 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"; - return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/CustomerWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/CustomerWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/CustomerWriter.java deleted file mode 100644 index acf7f81..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/CustomerWriter.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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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.polygene.api.identity.HasIdentity;"); - pw.println("import org.apache.polygene.api.property.Property;"); - pw.println(); - pw.println( - "public interface Customer extends HasIdentity\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"; - return FileUtils.createJavaClassPrintWriter( properties, "model", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/DomainLayerWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/DomainLayerWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/DomainLayerWriter.java deleted file mode 100644 index dd8a684..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/DomainLayerWriter.java +++ /dev/null @@ -1,72 +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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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 org.apache.polygene.bootstrap.AssemblyException;\n" + - "import org.apache.polygene.bootstrap.LayerAssembly;\n" + - "import org.apache.polygene.bootstrap.layered.LayerAssembler;\n" + - "import org.apache.polygene.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" - ); - } - } - - private PrintWriter createPrinter( Map<String, String> properties ) - throws IOException - { - String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/domain/"; - String classname = "DomainLayer"; - return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/FileConfigurationModuleWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/FileConfigurationModuleWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/FileConfigurationModuleWriter.java deleted file mode 100644 index c4bdacb..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/FileConfigurationModuleWriter.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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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.polygene.api.common.Visibility;\n" + - "import org.apache.polygene.bootstrap.AssemblyException;\n" + - "import org.apache.polygene.bootstrap.LayerAssembly;\n" + - "import org.apache.polygene.bootstrap.ModuleAssembly;\n" + - "import org.apache.polygene.bootstrap.layered.ModuleAssembler;\n" + - "import org.apache.polygene.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"; - return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/HardCodedSecurityRepositoryMixinWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/HardCodedSecurityRepositoryMixinWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/HardCodedSecurityRepositoryMixinWriter.java deleted file mode 100644 index 987ff2f..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/HardCodedSecurityRepositoryMixinWriter.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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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.polygene.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"; - return FileUtils.createJavaClassPrintWriter( properties, "model", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/IndexingModuleWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/IndexingModuleWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/IndexingModuleWriter.java deleted file mode 100644 index ef714f0..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/IndexingModuleWriter.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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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.polygene.api.common.Visibility;\n" + - "import org.apache.polygene.bootstrap.AssemblyException;\n" + - "import org.apache.polygene.bootstrap.LayerAssembly;\n" + - "import org.apache.polygene.bootstrap.ModuleAssembly;\n" + - "import org.apache.polygene.bootstrap.layered.ModuleAssembler;\n" + - "import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;\n" + - "import org.apache.polygene.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" + - " 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"; - return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/InfrastructureLayerWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/InfrastructureLayerWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/InfrastructureLayerWriter.java deleted file mode 100644 index 464e938..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/InfrastructureLayerWriter.java +++ /dev/null @@ -1,84 +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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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 org.apache.polygene.bootstrap.AssemblyException;\n" + - "import org.apache.polygene.bootstrap.LayerAssembly;\n" + - "import org.apache.polygene.bootstrap.ModuleAssembly;\n" + - "import org.apache.polygene.bootstrap.layered.LayerAssembler;\n" + - "import org.apache.polygene.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" + - "\n" + - " public InfrastructureLayer( ModuleAssembly configModule )\n" + - " {\n" + - " this.configModule = configModule;\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().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"; - return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderItemWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderItemWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderItemWriter.java deleted file mode 100644 index 9540dd2..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderItemWriter.java +++ /dev/null @@ -1,64 +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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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.polygene.api.identity.HasIdentity;"); - pw.println("import org.apache.polygene.api.property.Property;"); - pw.println(); - pw.println( - "public interface OrderItem extends HasIdentity\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"; - return FileUtils.createJavaClassPrintWriter( properties, "model", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderModuleWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderModuleWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderModuleWriter.java deleted file mode 100644 index 7cf4b75..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderModuleWriter.java +++ /dev/null @@ -1,83 +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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.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.polygene.api.common.Visibility;\n" + - "import org.apache.polygene.bootstrap.AssemblyException;\n" + - "import org.apache.polygene.bootstrap.LayerAssembly;\n" + - "import org.apache.polygene.bootstrap.ModuleAssembly;\n" + - "import org.apache.polygene.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"; - return FileUtils.createJavaClassPrintWriter( properties, "bootstrap", packagename, classname ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea639e83/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderWriter.java deleted file mode 100644 index 94ab2eb..0000000 --- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/common/OrderWriter.java +++ /dev/null @@ -1,69 +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.polygene.tools.shell.create.project.common; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import org.apache.polygene.tools.shell.FileUtils; - -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.polygene.api.association.Association;"); - pw.println("import org.apache.polygene.api.association.ManyAssociation;"); - pw.println("import org.apache.polygene.api.common.Optional;"); - pw.println("import org.apache.polygene.api.identity.HasIdentity;"); - pw.println("import org.apache.polygene.api.property.Property;"); - pw.println(); - pw.println( - "public interface Order extends HasIdentity\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"; - return FileUtils.createJavaClassPrintWriter( properties, "model", packagename, classname ); - } -}
