You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/12/17 10:28:54 UTC
[78/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ;
Rename of everything else from zest to polygene.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java
deleted file mode 100644
index a8e54ee..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java
+++ /dev/null
@@ -1,399 +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.test.performance.indexing.rdf;
-
-import java.io.File;
-import org.apache.derby.iapi.services.io.FileUtil;
-import org.apache.polygene.api.query.QueryBuilderFactory;
-import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.entity.EntityBuilder;
-import org.apache.polygene.api.entity.EntityComposite;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.api.query.Query;
-import org.apache.polygene.api.query.QueryBuilder;
-import org.apache.polygene.api.service.ServiceComposite;
-import org.apache.polygene.api.service.ServiceReference;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.Energy4Java;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.memory.assembly.MemoryEntityStoreAssembler;
-import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
-import org.apache.polygene.index.rdf.indexing.RdfIndexingService;
-import org.apache.polygene.index.rdf.query.SesameExpressions;
-import org.apache.polygene.library.rdf.repository.NativeConfiguration;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
-
-import static org.apache.polygene.api.query.QueryExpressions.eq;
-import static org.apache.polygene.api.query.QueryExpressions.templateFor;
-
-@SuppressWarnings( "ResultOfMethodCallIgnored" )
-public class QueryPerformanceTest
- implements ApplicationAssembler
-{
- private static final int NUMBER_OF_ENTITIES = 100000;
- private static final String LAYER_INFRASTRUCTURE = "LAYER_INFRASTRUCTURE";
- private static final String MODULE_PERSISTENCE = "MODULE_PERSISTENCE";
- private static final String LAYER_CONFIGURATION = "CONFIGURATION";
- private static final String LAYER_DOMAIN = "LAYER_DOMAIN";
- private static final String MODULE_DOMAIN = "MODULE_DOMAIN";
- private static final String MODULE_CONFIG = "MODULE_CONFIG";
-
- private Application application;
- private Module module;
- private UnitOfWorkFactory uowf;
- private static final String QUERY1 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
- + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
- + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
- + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
- + "SELECT ?entityType ?reference\n"
- + "WHERE {\n"
- + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
- + "?entity rdf:type ?entityType. \n"
- + "?entity ns0:reference ?reference. \n"
- + "?entity ns1:name \"Lead64532\". \n"
- + "}";
- private static final String QUERY2 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
- + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
- + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
- + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
- + "SELECT ?entityType ?reference\n"
- + "WHERE {\n"
- + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
- + "?entity rdf:type ?entityType. \n"
- + "?entity ns0:reference ?reference. \n"
- + "?entity ns1:name \"Lead98276\". \n"
- + "}";
- private static final String QUERY3 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
- + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
- + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
- + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
- + "SELECT ?entityType ?reference\n"
- + "WHERE {\n"
- + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
- + "?entity rdf:type ?entityType. \n"
- + "?entity ns0:reference ?reference. \n"
- + "?entity ns1:name \"Lead2\". \n"
- + "}";
- private static final String QUERY4 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
- + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
- + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
- + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
- + "SELECT ?entityType ?reference\n"
- + "WHERE {\n"
- + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
- + "?entity rdf:type ?entityType. \n"
- + "?entity ns0:reference ?reference. \n"
- + "?entity ns1:name \"Lead14332\". \n"
- + "}";
- private static final String QUERY5 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
- + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
- + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
- + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
- + "SELECT ?entityType ?reference\n"
- + "WHERE {\n"
- + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
- + "?entity rdf:type ?entityType. \n"
- + "?entity ns0:reference ?reference. \n"
- + "?entity ns1:name \"Lead632\". \n"
- + "}";
- private File indexingDataDir;
-
- @Before
- public void setup()
- throws Exception
- {
- Energy4Java polygene = new Energy4Java();
- application = polygene.newApplication( this );
- module = application.findModule( LAYER_DOMAIN, MODULE_DOMAIN );
- application.activate();
- indexingDataDir = module.findService( RdfIndexingService.class ).get().dataDir();
- uowf = module.unitOfWorkFactory();
- }
-
- @After
- public void tearDown()
- throws Exception
- {
- try
- {
- if( application != null )
- {
- System.out.println( "Shutting Down test." );
- application.passivate();
- }
- }
- finally
- {
- FileUtil.removeDirectory( indexingDataDir );
- }
- }
-
- @Override
- public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
- throws AssemblyException
- {
- ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly();
- LayerAssembly infra = createInfrastructureLayer( applicationAssembly );
- LayerAssembly domain = createDomainLayer( applicationAssembly );
- LayerAssembly config = createConfigurationLayer( applicationAssembly );
- infra.uses( config );
- domain.uses( infra );
- return applicationAssembly;
- }
-
- @Test
- public void testIndexingFluentQueries()
- throws Exception
- {
- LeadRepository leadRepo = populateEntityStore();
- measureFluentQuery( leadRepo, "Lead64531" );
- measureFluentQuery( leadRepo, "Lead98275" );
- measureFluentQuery( leadRepo, "Lead3" );
- measureFluentQuery( leadRepo, "Lead14331" );
- measureFluentQuery( leadRepo, "Lead631" );
- }
-
- @Test
- public void testIndexingNamedQueries()
- throws Exception
- {
- LeadRepository leadRepo = populateEntityStore();
- measureNamedQuery( leadRepo, QUERY1 );
- measureNamedQuery( leadRepo, QUERY2 );
- measureNamedQuery( leadRepo, QUERY3 );
- measureNamedQuery( leadRepo, QUERY4 );
- measureNamedQuery( leadRepo, QUERY5 );
- }
-
- private LeadRepository populateEntityStore()
- throws UnitOfWorkCompletionException
- {
- UnitOfWork uow = uowf.newUnitOfWork();
- try
- {
- LeadRepository leadRepo = module.findService( LeadRepositoryService.class ).get();
- if( leadRepo.findByName( "Lead99999" ) == null )
- {
- ServiceReference<LeadEntityFactoryService> leadFactoryRef = module.findService( LeadEntityFactoryService.class );
- LeadEntityFactory leadFactory = leadFactoryRef.get();
- long start, end;
- start = System.currentTimeMillis();
- for( int i = 1; i < NUMBER_OF_ENTITIES; i++ )
- {
- if( ( i % 10000 ) == 0 )
- {
- System.out.print( "\r" + i );
- uow.complete();
- uow = uowf.newUnitOfWork();
- }
- leadFactory.create( "Lead" + i );
- }
- System.out.println();
- uow.complete();
- end = System.currentTimeMillis();
- System.out.println( "Population time: " + ( end - start ) );
- }
- return leadRepo;
- }
- finally
- {
- if( uow != null && uow.isOpen() )
- {
- uow.discard();
- }
- }
- }
-
- private void measureFluentQuery( LeadRepository leadRepo, String nameOfEntity )
- throws Exception
- {
- long start;
- long end;
- try( UnitOfWork uow = uowf.newUnitOfWork() )
- {
- start = System.currentTimeMillis();
- Lead lead = leadRepo.findByName( nameOfEntity );
- end = System.currentTimeMillis();
- if( lead == null )
- {
- Assert.fail( "Entity was not found or more than one entity was found." );
- return;
- }
- System.out.println( "Lead: " + lead );
- System.out.println( "Retrieval time of " + lead.name().get() + " by name: " + ( end - start ) );
- uow.complete();
- }
- }
-
- private void measureNamedQuery( LeadRepository leadRepo, String queryName )
- throws Exception
- {
- long start;
- long end;
- try( UnitOfWork uow = uowf.newUnitOfWork() )
- {
- start = System.currentTimeMillis();
- Lead lead = leadRepo.findByFixedQuery( queryName );
- end = System.currentTimeMillis();
- if( lead == null )
- {
- Assert.fail( "Entity was not found or more than one entity was found." );
- return;
- }
- System.out.println( "Lead: " + lead );
- System.out.println( "Retrieval time of " + lead.name().get() + " by name: " + ( end - start ) );
- uow.complete();
- }
- }
-
- private LayerAssembly createDomainLayer( ApplicationAssembly applicationAssembly )
- throws AssemblyException
- {
- LayerAssembly domainLayer = applicationAssembly.layer( LAYER_DOMAIN );
- ModuleAssembly domainModule = domainLayer.module( MODULE_DOMAIN );
- domainModule.addServices( LeadRepositoryService.class );
- domainModule.addServices( LeadEntityFactoryService.class );
- domainModule.entities( LeadEntity.class );
- return domainLayer;
- }
-
- private LayerAssembly createInfrastructureLayer( ApplicationAssembly applicationAssembly )
- throws AssemblyException
- {
- LayerAssembly infrastructureLayer = applicationAssembly.layer( LAYER_INFRASTRUCTURE );
-
- // Persistence module
- ModuleAssembly persistenceModule = infrastructureLayer.module( MODULE_PERSISTENCE );
-
- // Indexing
- new RdfNativeSesameStoreAssembler().assemble( persistenceModule );
-
- // Entity store
- new OrgJsonValueSerializationAssembler().assemble( persistenceModule );
- new MemoryEntityStoreAssembler().visibleIn( Visibility.application ).assemble( persistenceModule );
-
- return infrastructureLayer;
- }
-
- private LayerAssembly createConfigurationLayer( ApplicationAssembly applicationAssembly )
- throws AssemblyException
- {
- LayerAssembly layer = applicationAssembly.layer( LAYER_CONFIGURATION );
- ModuleAssembly configModule = layer.module( MODULE_CONFIG );
- configModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application );
- new EntityTestAssembler().assemble( configModule );
- return layer;
- }
-
- public interface Lead
- {
- Property<String> name();
- }
-
- public interface LeadEntity
- extends Lead, EntityComposite
- {
- }
-
- @Mixins( LeadEntityFactoryMixin.class )
- public interface LeadEntityFactoryService
- extends LeadEntityFactory, ServiceComposite
- {
- }
-
- public interface LeadEntityFactory
- {
- Lead create( String name );
- }
-
- public static class LeadEntityFactoryMixin
- implements LeadEntityFactory
- {
- @Structure
- private UnitOfWorkFactory uowf;
-
- @Override
- public Lead create( String name )
- {
- UnitOfWork uow = uowf.currentUnitOfWork();
- EntityBuilder<LeadEntity> builder = uow.newEntityBuilder( LeadEntity.class );
- Lead prototype = builder.instanceFor( LeadEntity.class );
- prototype.name().set( name );
- return builder.newInstance();
- }
- }
-
- public interface LeadRepository
- {
- Lead findByFixedQuery( String name );
-
- Lead findByName( String name );
- }
-
- @Mixins( LeadRepositoryMixin.class )
- public interface LeadRepositoryService
- extends LeadRepository, ServiceComposite
- {
- }
-
- public static class LeadRepositoryMixin
- implements LeadRepository
- {
- @Structure
- private QueryBuilderFactory qbf;
-
- @Structure
- private UnitOfWorkFactory uowf;
-
- @Override
- public Lead findByFixedQuery( String queryString )
- {
- UnitOfWork uow = uowf.currentUnitOfWork();
- Query<Lead> query = uow.newQuery( qbf.newQueryBuilder( Lead.class ).where( SesameExpressions.sparql( queryString ) ) );
- return query.find();
- }
-
- @Override
- public Lead findByName( String name )
- {
- UnitOfWork uow = uowf.currentUnitOfWork();
- QueryBuilder<Lead> builder = qbf.newQueryBuilder( Lead.class );
- Lead template = templateFor( Lead.class );
-
- Query<Lead> query = uow.newQuery( builder.where( eq( template.name(), name ) ) );
- return query.find();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
deleted file mode 100644
index 449ecf4..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
+++ /dev/null
@@ -1,287 +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.test.performance.runtime.composite;
-
-import org.apache.polygene.api.activation.ActivationException;
-import org.apache.polygene.api.composite.TransientBuilderFactory;
-import org.apache.polygene.api.composite.TransientComposite;
-import org.apache.polygene.api.object.ObjectFactory;
-import org.apache.polygene.api.value.ValueBuilderFactory;
-import org.apache.polygene.api.value.ValueComposite;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
-import org.junit.Test;
-
-/**
- * Tests performance of new composite creation.
- */
-public class CompositeCreationPerformanceTest
-{
- @Test
- public void newInstanceForRegisteredCompositePerformance()
- throws ActivationException, AssemblyException, InterruptedException
- {
- SingletonAssembler assembler = new SingletonAssembler()
- {
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.transients( AnyComposite.class );
- module.objects( AnyObject.class );
- module.values( AnyValue.class );
- }
- };
- int warmups = 10;
- int runs = 20;
- long waitBeforeRun = 1000;
- long waitBetweenRuns = 500;
- long timeForJavaObject = 0;
- {
- // Warmup
- for( int i = 0; i < warmups; i++ )
- {
- testJavaObjectCreationPerformance( false );
- }
- Thread.sleep( waitBeforeRun );
- // Run
- for( int i = 0; i < runs; i++ )
- {
- timeForJavaObject += testJavaObjectCreationPerformance( true );
- Thread.sleep( waitBetweenRuns );
- }
- timeForJavaObject = timeForJavaObject / runs;
- }
- long timeForTransientComposite = 0;
- {
- TransientBuilderFactory module = assembler.module();
- // Warmup
- for( int i = 0; i < warmups; i++ )
- {
- testCompositeCreationPerformance( module, false );
- }
- Thread.sleep( waitBeforeRun );
- // Run
- for( int i = 0; i < runs; i++ )
- {
- timeForTransientComposite += testCompositeCreationPerformance( module, true );
- Thread.sleep( waitBetweenRuns );
- }
- timeForTransientComposite = timeForTransientComposite / runs;
- }
- long timeForManagedObject = 0;
- {
- ObjectFactory objectFactory = assembler.module();
- // Warmup
- for( int i = 0; i < warmups; i++ )
- {
- testObjectCreationPerformance( objectFactory, false );
- }
- Thread.sleep( waitBeforeRun );
- // Run
- for( int i = 0; i < runs; i++ )
- {
- timeForManagedObject += testObjectCreationPerformance( objectFactory, true );
- Thread.sleep( waitBetweenRuns );
- }
- timeForManagedObject = timeForManagedObject / runs;
- }
- long timeForValueComposite = 0;
- {
- ValueBuilderFactory valueBuilderFactory = assembler.module();
- // Warmup
- for( int i = 0; i < warmups; i++ )
- {
- testValueCreationPerformance( valueBuilderFactory, false );
- }
- Thread.sleep( waitBeforeRun );
- // Run
- for( int i = 0; i < runs; i++ )
- {
- timeForValueComposite += testValueCreationPerformance( valueBuilderFactory, true );
- Thread.sleep( waitBetweenRuns );
- }
- timeForValueComposite = timeForValueComposite / runs;
- }
-
- long timeForTransientCompositeBuilder = 0;
- {
- TransientBuilderFactory module = assembler.module();
- // Warmup
- for( int i = 0; i < warmups; i++ )
- {
- testCompositeCreationWithBuilderPerformance( module, false );
- }
- Thread.sleep( waitBeforeRun );
- // Run
- for( int i = 0; i < runs; i++ )
- {
- timeForTransientCompositeBuilder += testCompositeCreationWithBuilderPerformance( module, true );
- Thread.sleep( waitBetweenRuns );
- }
- timeForTransientCompositeBuilder = timeForTransientCompositeBuilder / runs;
- }
- long timeForValueCompositeBuilder = 0;
- {
- ValueBuilderFactory valueBuilderFactory = assembler.module();
- // Warmup
- for( int i = 0; i < warmups; i++ )
- {
- testValueCreationWithBuilderPerformance( valueBuilderFactory, false );
- }
- Thread.sleep( waitBeforeRun );
- // Run
- for( int i = 0; i < runs; i++ )
- {
- timeForValueCompositeBuilder += testValueCreationWithBuilderPerformance( valueBuilderFactory, true );
- Thread.sleep( waitBetweenRuns );
- }
- timeForValueCompositeBuilder = timeForValueCompositeBuilder / runs;
- }
-
- System.out.println( "----" );
- System.out.println( "Transient: " + ( timeForTransientComposite / timeForJavaObject ) + "x" );
- System.out.println( "TransientBuilder: " + ( timeForTransientCompositeBuilder / timeForJavaObject ) + "x" );
- System.out.println( "Value: " + ( timeForValueComposite / timeForJavaObject ) + "x" );
- System.out.println( "ValueBuilder: " + ( timeForValueCompositeBuilder / timeForJavaObject ) + "x" );
- System.out.println( "Object: " + ( timeForManagedObject / timeForJavaObject ) + "x" );
- }
-
- private long testCompositeCreationPerformance( TransientBuilderFactory module, boolean run )
- {
- long start = System.currentTimeMillis();
- int iter = 1000000;
- for( int i = 0; i < iter; i++ )
- {
- module.newTransient( AnyComposite.class );
- }
-
- long end = System.currentTimeMillis();
- long time = 1000000L * ( end - start ) / iter;
- if( run )
- {
- System.out.println( "Composite Creation Time:" + time + " nanoseconds per composite" );
- }
- return time;
- }
-
- private long testCompositeCreationWithBuilderPerformance( TransientBuilderFactory module, boolean run )
- {
- long start = System.currentTimeMillis();
- int iter = 1000000;
- for( int i = 0; i < iter; i++ )
- {
- module.newTransientBuilder( AnyComposite.class ).newInstance();
- }
-
- long end = System.currentTimeMillis();
- long time = 1000000L * ( end - start ) / iter;
- if( run )
- {
- System.out.println( "Composite (builder) Creation Time:" + time + " nanoseconds per composite" );
- }
- return time;
- }
-
- private long testValueCreationPerformance( ValueBuilderFactory valueBuilderFactory, boolean run )
- {
- long start = System.currentTimeMillis();
- int iter = 1000000;
- for( int i = 0; i < iter; i++ )
- {
- valueBuilderFactory.newValue( AnyValue.class );
- }
-
- long end = System.currentTimeMillis();
- long time = 1000000L * ( end - start ) / iter;
- if( run )
- {
- System.out.println( "Value Creation Time:" + time + " nanoseconds per composite" );
- }
- return time;
- }
-
- private long testValueCreationWithBuilderPerformance( ValueBuilderFactory valueBuilderFactory, boolean run )
- {
- long start = System.currentTimeMillis();
- int iter = 1000000;
- for( int i = 0; i < iter; i++ )
- {
- valueBuilderFactory.newValueBuilder( AnyValue.class ).newInstance();
- }
-
- long end = System.currentTimeMillis();
- long time = 1000000L * ( end - start ) / iter;
- if( run )
- {
- System.out.println( "Value (builder) Creation Time:" + time + " nanoseconds per composite" );
- }
- return time;
- }
-
- private long testObjectCreationPerformance( ObjectFactory objectFactory, boolean run )
- {
- long start = System.currentTimeMillis();
- int iter = 1000000;
- for( int i = 0; i < iter; i++ )
- {
- objectFactory.newObject( AnyObject.class );
- }
-
- long end = System.currentTimeMillis();
- long time = 1000000L * ( end - start ) / iter;
- if( run )
- {
- System.out.println( "Polygene Object Creation Time:" + time + " nanoseconds per object" );
- }
- return time;
- }
-
- private long testJavaObjectCreationPerformance( boolean run )
- {
- long start = System.currentTimeMillis();
- int iter = 1000000;
- for( int i = 0; i < iter; i++ )
- {
- new AnyObject();
- }
-
- long end = System.currentTimeMillis();
- long time = 1000000L * ( end - start ) / iter;
- if( run )
- {
- System.out.println( "Java Object Creation Time:" + time + " nanoseconds per object" );
- }
- return time;
- }
-
- public interface AnyComposite
- extends TransientComposite
- {
- }
-
- public interface AnyValue
- extends ValueComposite
- {
- }
-
- public static class AnyObject
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java
deleted file mode 100644
index c63e33a..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java
+++ /dev/null
@@ -1,204 +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.test.performance.runtime.composite;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.text.NumberFormat;
-import org.junit.Test;
-import org.apache.polygene.api.composite.TransientBuilder;
-import org.apache.polygene.api.composite.TransientComposite;
-import org.apache.polygene.api.concern.ConcernOf;
-import org.apache.polygene.api.concern.Concerns;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
-
-/**
- * Invocation performance test.
- * <p>
- * Don't forget to add VM value "-server" before running this test!
- * </p>
- * <p>
- * These tests are very sensitive to warmup of JVM, hence the duplication. Often the first round
- * is only for getting the code jitted, and the second round is what you want to look at.
- * </p>
- */
-public class InvocationPerformanceTest
- extends AbstractPolygeneTest
-{
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.transients( SimpleComposite.class );
- module.transients( SimpleWithTypedConcernComposite.class );
- module.transients( SimpleWithGenericConcernComposite.class );
- }
-
- @Test
- public void testInvokeMixin()
- {
- // Create instance
- TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
- Simple simple = builder.newInstance();
-
- for( int i = 0; i < 60000; i++ )
- {
- simple.test();
- }
-
- int rounds = 10;
- for( int i = 0; i < rounds; i++ )
- {
- System.gc();
- performanceCheck( simple );
- }
- }
-
- @Test
- public void testInvokeMixinWithTypedConcern()
- {
- // Create instance
- Simple simple = transientBuilderFactory.newTransient( SimpleWithTypedConcernComposite.class );
-
- for( int i = 0; i < 60000; i++ )
- {
- simple.test();
- }
-
- int rounds = 3;
- for( int i = 0; i < rounds; i++ )
- {
- performanceCheck( simple );
- }
- }
-
- @Test
- public void testInvokeMixinWithGenericConcern()
- {
- // Create instance
- Simple simple = transientBuilderFactory.newTransient( SimpleWithGenericConcernComposite.class );
-
- for( int i = 0; i < 60000; i++ )
- {
- simple.test();
- }
-
- int rounds = 3;
- for( int i = 0; i < rounds; i++ )
- {
- performanceCheck( simple );
- }
- }
-
- @Test
- public void testInvokeMixin2()
- {
- testInvokeMixin();
- }
-
- @Test
- public void testInvokeMixinWithTypedConcern2()
- {
- testInvokeMixinWithTypedConcern();
- }
-
- @Test
- public void testInvokeMixinWithGenericConcern2()
- {
- testInvokeMixinWithGenericConcern();
- }
-
- private void performanceCheck( Simple simple )
- {
- long count = 10000000L;
-
- long start = System.currentTimeMillis();
- for( long i = 0; i < count; i++ )
- {
- simple.test();
- }
- long end = System.currentTimeMillis();
- long time = end - start;
- long callsPerSecond = ( count / time ) * 1000;
- System.out.println( "Calls per second: " + NumberFormat.getIntegerInstance().format( callsPerSecond ) );
- }
-
- @Mixins( SimpleMixin.class )
- @Concerns( SimpleTypedConcern.class )
- public interface SimpleWithTypedConcernComposite
- extends Simple, TransientComposite
- {
- }
-
- @Mixins( SimpleMixin.class )
- @Concerns( SimpleGenericConcern.class )
- public interface SimpleWithGenericConcernComposite
- extends Simple, TransientComposite
- {
- }
-
- @Mixins( SimpleMixin.class )
- public interface SimpleComposite
- extends Simple, TransientComposite
- {
- }
-
- public interface Simple
- {
- public void test();
- }
-
- public static class SimpleMixin
- implements Simple
- {
- long count = 0;
-
- @Override
- public void test()
- {
- count++; // Do nothing
- }
- }
-
- public static class SimpleTypedConcern
- extends ConcernOf<Simple>
- implements Simple
- {
- @Override
- public void test()
- {
- next.test();
- }
- }
-
- public static class SimpleGenericConcern
- extends ConcernOf<InvocationHandler>
- implements InvocationHandler
- {
- @Override
- public Object invoke( Object o, Method method, Object[] objects )
- throws Throwable
- {
- return next.invoke( o, method, objects );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
deleted file mode 100644
index 7508fe2..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
+++ /dev/null
@@ -1,134 +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.test.performance.runtime.composite;
-
-import java.text.NumberFormat;
-import java.util.Locale;
-import org.junit.Test;
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.composite.TransientBuilder;
-import org.apache.polygene.api.composite.TransientComposite;
-import org.apache.polygene.api.injection.scope.State;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
-
-/**
- * PropertyMixin invocation performance test.
- * <p>
- * Don't forget to add VM value "-server" before running this test!
- * </p>
- */
-public class PropertyMixinInvocationPerformanceTest
- extends AbstractPolygeneTest
-{
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.transients( SimpleComposite.class );
- module.transients( SimpleComposite2.class );
- }
-
- @Test
- public void testNewInstance()
- {
- {
- TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
- SimpleComposite simple = builder.newInstance();
-
- int rounds = 1;
- for( int i = 0; i < rounds; i++ )
- {
- performanceCheck( simple );
- }
- }
-
- {
- TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
- SimpleComposite simple = builder.newInstance();
-
- int rounds = 1;
- for( int i = 0; i < rounds; i++ )
- {
- performanceCheck( simple );
- }
- }
- }
-
- private void performanceCheck( SimpleComposite simple )
- {
- long count = 10000000L;
-
- {
- long start = System.currentTimeMillis();
- for( long i = 0; i < count; i++ )
- {
- simple.test();
- }
- long end = System.currentTimeMillis();
- long time = end - start;
- long callsPerSecond = ( count / time ) * 1000;
- System.out.println( "Accesses per second: "
- + NumberFormat.getIntegerInstance( Locale.US ).format( callsPerSecond ) );
- }
-
- {
- long start = System.currentTimeMillis();
- for( long i = 0; i < count; i++ )
- {
- simple.test().get();
- }
- long end = System.currentTimeMillis();
- long time = end - start;
- long callsPerSecond = ( count / time ) * 1000;
- System.out.println( "Gets per second: "
- + NumberFormat.getIntegerInstance( Locale.US ).format( callsPerSecond ) );
- }
- }
-
- public interface SimpleComposite
- extends TransientComposite
- {
- @Optional
- Property<String> test();
- }
-
- @Mixins( SimpleMixin.class )
- public interface SimpleComposite2
- extends SimpleComposite
- {
- }
-
- public abstract static class SimpleMixin
- implements SimpleComposite2
- {
- @State
- Property<String> test;
-
- @Override
- public Property<String> test()
- {
- return test;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/object/ObjectCreationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/object/ObjectCreationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/object/ObjectCreationPerformanceTest.java
deleted file mode 100644
index b995770..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/object/ObjectCreationPerformanceTest.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.test.performance.runtime.object;
-
-import org.junit.Test;
-import org.apache.polygene.api.activation.ActivationException;
-import org.apache.polygene.api.object.ObjectFactory;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
-
-/**
- * Tests performance of new object creation.
- */
-public class ObjectCreationPerformanceTest
-{
-
- @Test
- public void newInstanceForRegisteredObjectPerformance()
- throws ActivationException, AssemblyException
- {
- SingletonAssembler assembler = new SingletonAssembler()
- {
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.objects( AnyObject.class );
- }
- };
- ObjectFactory objectFactory = assembler.module();
- for( int i = 0; i < 10; i++ )
- {
- testPerformance( objectFactory );
- }
- }
-
- private void testPerformance( ObjectFactory objectFactory )
- {
- long start = System.currentTimeMillis();
- int iter = 1000000;
- for( int i = 0; i < iter; i++ )
- {
- objectFactory.newObject( AnyObject.class );
- }
-
- long end = System.currentTimeMillis();
- System.out.println( end - start );
- }
-
- public static final class AnyObject
- {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/service/ServiceInvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
deleted file mode 100644
index c599f6e..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
+++ /dev/null
@@ -1,113 +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.test.performance.runtime.service;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.text.NumberFormat;
-import junit.framework.TestCase;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.service.ServiceComposite;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
-
-public class ServiceInvocationPerformanceTest
- extends TestCase
-{
- @Service
- ServiceInvocationPerformanceTest.MyService service;
-
- public void testInjectService()
- throws Exception
- {
- SingletonAssembler assembly = new SingletonAssembler()
- {
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.services( ServiceInvocationPerformanceTest.MyServiceComposite.class );
- module.objects( ServiceInvocationPerformanceTest.class );
- }
- };
-
- assembly.module().injectTo( this );
-
- // Warmup
- for( int i = 0; i < 60000; i++ )
- {
- service.test();
- }
-
- int rounds = 5;
- for( int i = 0; i < rounds; i++ )
- {
- performanceCheck( service );
- }
- }
-
- private void performanceCheck( MyService simple )
- {
- long count = 10000000L;
-
- long start = System.currentTimeMillis();
- for( long i = 0; i < count; i++ )
- {
- simple.test();
- }
- long end = System.currentTimeMillis();
- long time = end - start;
- long callsPerSecond = ( count / time ) * 1000;
- System.out.println( "Calls per second: " + NumberFormat.getIntegerInstance().format( callsPerSecond ) );
- }
-
- @Mixins( NoopMixin.class )
- public static interface MyServiceComposite
- extends ServiceInvocationPerformanceTest.MyService, ServiceComposite
- {
- }
-
- public static interface MyService
- {
- void test();
- }
-
- public static class MyServiceMixin
- implements ServiceInvocationPerformanceTest.MyService
- {
- @Override
- public void test()
- {
- }
- }
-
- public final static class NoopMixin
- implements InvocationHandler
- {
- @Override
- public Object invoke( Object object, Method method, Object[] objects )
- throws Throwable
- {
- return null;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/resources/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.properties
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/resources/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.properties b/tests/performance/src/perf/resources/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.properties
new file mode 100644
index 0000000..8527b21
--- /dev/null
+++ b/tests/performance/src/perf/resources/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.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.
+#
+#
+#
+
+
+# The file that will contain the JDBM data.
+file=build/tmp/jdbm/jdbmstore.data
+
+disableTransactions=false
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/resources/org/apache/polygene/library/rdf/repository/rdf-indexing.properties
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/resources/org/apache/polygene/library/rdf/repository/rdf-indexing.properties b/tests/performance/src/perf/resources/org/apache/polygene/library/rdf/repository/rdf-indexing.properties
new file mode 100644
index 0000000..2cb86eb
--- /dev/null
+++ b/tests/performance/src/perf/resources/org/apache/polygene/library/rdf/repository/rdf-indexing.properties
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+#
+#
+
+tripleIndexes=spoc,ospc
+dataDirectory=build/tmp/rdf
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/resources/org/apache/zest/entitystore/jdbm/JdbmEntityStoreService.properties
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/resources/org/apache/zest/entitystore/jdbm/JdbmEntityStoreService.properties b/tests/performance/src/perf/resources/org/apache/zest/entitystore/jdbm/JdbmEntityStoreService.properties
deleted file mode 100644
index 8527b21..0000000
--- a/tests/performance/src/perf/resources/org/apache/zest/entitystore/jdbm/JdbmEntityStoreService.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.
-#
-#
-#
-
-
-# The file that will contain the JDBM data.
-file=build/tmp/jdbm/jdbmstore.data
-
-disableTransactions=false
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/resources/org/apache/zest/library/rdf/repository/rdf-indexing.properties
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/resources/org/apache/zest/library/rdf/repository/rdf-indexing.properties b/tests/performance/src/perf/resources/org/apache/zest/library/rdf/repository/rdf-indexing.properties
deleted file mode 100644
index 2cb86eb..0000000
--- a/tests/performance/src/perf/resources/org/apache/zest/library/rdf/repository/rdf-indexing.properties
+++ /dev/null
@@ -1,22 +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.
-#
-#
-#
-
-tripleIndexes=spoc,ospc
-dataDirectory=build/tmp/rdf
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/index.js b/tools/generator-polygene/app/index.js
new file mode 100644
index 0000000..73f44e6
--- /dev/null
+++ b/tools/generator-polygene/app/index.js
@@ -0,0 +1,317 @@
+/*
+ * 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.
+ *
+ *
+ */
+
+var generators = require( 'yeoman-generator' );
+
+var polygene = {};
+
+module.exports = generators.Base.extend(
+ {
+ // The name `constructor` is important here
+ constructor: function ()
+ {
+ // Calling the super constructor is important so our generator is correctly set up
+ generators.Base.apply( this, arguments );
+
+ // this.option( 'coffee' ); // This method adds support for a `--coffee` flag
+ },
+
+ method1: function ()
+ {
+ console.log( 'method 1 just ran' );
+ },
+ method2: function ()
+ {
+ console.log( 'method 2 just ran' );
+ },
+ prompting: function ()
+ {
+ return this.prompt(
+ [
+ {
+ type: 'input',
+ name: 'name',
+ message: 'Your project name',
+ default: firstUpper( this.appname )
+ },
+ {
+ type: 'input',
+ name: 'packagename',
+ message: 'Java package name',
+ default: this.appname // Default to current folder name
+ },
+ {
+ type: 'list',
+ name: 'entitystore',
+ choices: [
+ 'File',
+ 'Geode',
+ 'Hazelcast',
+ 'JClouds',
+ 'Jdbm',
+ 'LevelDB',
+ 'Memory',
+ 'MongoDB',
+ 'Preferences',
+ 'Redis',
+ 'Riak',
+ 'MySQL',
+ 'PostgresSQL',
+ 'SQLite',
+ 'H2SQL',
+ 'DerbySQL'
+ ],
+ message: 'Which entity store do you want to use?'
+ },
+ {
+ type: 'list',
+ name: 'indexing',
+ choices: [
+ 'Rdf',
+ 'ElasticSearch',
+ 'Solr',
+ 'SQL'
+ ],
+ message: 'Which caching system do you want to use?'
+ },
+ {
+ type: 'list',
+ name: 'caching',
+ choices: [
+ 'none',
+ 'memcache',
+ 'ehcache'
+ ],
+ message: 'Which serialization system do you want to use?'
+ },
+ {
+ type: 'list',
+ name: 'serialization',
+ choices: [
+ 'Jackson',
+ 'Stax',
+ 'OrgJson'
+ ],
+ message: 'Which indexing system do you want to use?'
+ },
+ {
+ type: 'checkbox',
+ name: 'features',
+ choices: [
+ 'rest api',
+ // 'reindexer',
+ // 'metrics',
+ // 'jmx',
+ // 'version migration',
+ 'sample (heroes) web application'
+ ],
+ message: 'Other features?'
+ }
+ ]
+ ).then( function ( answers )
+ {
+ this.log( 'app name', answers.name );
+ this.log( 'Entity Stores:', answers.entitystore );
+ this.log( 'Indexing:', answers.indexing );
+ this.log( 'Caching:', answers.caching );
+ this.log( 'Serialization:', answers.serialization );
+ this.log( 'Features:', answers.features );
+ polygene = answers;
+ polygene.javaPackageDir = polygene.packagename.replace( '.', '/' );
+ polygene.singletonApp = false;
+ if( hasFeature( 'sample (heroes) web application' ) )
+ {
+ polygene.features.push( 'rest api' );
+ }
+ }.bind( this )
+ );
+ },
+
+ writing: function ()
+ {
+ copyPolygeneBootstrap( this, "config", "ConfigurationLayer", !polygene.singeltonApp );
+ copyPolygeneBootstrap( this, "infrastructure", "InfrastructureLayer", !polygene.singeltonApp );
+ copyPolygeneBootstrap( this, "domain", "DomainLayer", !polygene.singeltonApp );
+ copyPolygeneBootstrap( this, "connectivity", "ConnectivityLayer", !polygene.singeltonApp );
+
+ copyPolygeneBootstrap( this, "config", "ConfigModule", true );
+
+ copyPolygeneBootstrap( this, "infrastructure", "FileConfigurationModule", true );
+
+ copyEntityStore( this, polygene.entitystore );
+
+ copyPolygeneBootstrap( this, "infrastructure", "RdfIndexingModule", hasIndexing( 'Rdf' ) );
+ copyPolygeneBootstrap( this, "infrastructure", "ElasticSearchIndexingModule", hasIndexing( 'Elasticsearch' ) );
+ copyPolygeneBootstrap( this, "infrastructure", "SolrIndexingModule", hasIndexing( 'Solr' ) );
+ copyPolygeneBootstrap( this, "infrastructure", "SqlIndexingModule", hasIndexing( 'Sql' ) );
+
+ copyPolygeneBootstrap( this, "infrastructure", "NoCachingModule", hasCaching( 'none' ) );
+ copyPolygeneBootstrap( this, "infrastructure", "MemcacheCachingModule", hasCaching( 'Memcache' ) );
+ copyPolygeneBootstrap( this, "infrastructure", "EhCacheCachingModule", hasCaching( 'Ehcache' ) );
+
+ copyPolygeneBootstrap( this, "infrastructure", "JacksonSerializationModule", hasSerialization( 'Jackson' ) );
+ copyPolygeneBootstrap( this, "infrastructure", "StaxSerializationModule", hasSerialization( 'Stax' ) );
+ copyPolygeneBootstrap( this, "infrastructure", "OrgJsonSerializationModule", hasSerialization( 'Orgjson' ) );
+
+ copyPolygeneBootstrap( this, "connectivity", "RestApiModule", hasFeature( 'rest api' ) );
+ copyPolygeneBootstrap( this, "infrastructure", "ReindexerModule", hasFeature( 'reindexer' ) );
+ copyPolygeneBootstrap( this, "infrastructure", "MetricsModule", hasFeature( 'metrics' ) );
+ copyPolygeneBootstrap( this, "infrastructure", "JmxModule", hasFeature( 'jmx' ) );
+ copyPolygeneBootstrap( this, "infrastructure", "MigrationModule", hasFeature( 'version migration' ) );
+
+ copyPolygeneBootstrap( this, "domain", "CrudModule", true );
+ copyHeroesSampleApp( this );
+ copyPolygeneDomain( this, "security", "RestApiModule", "SecurityRepository", hasFeature( 'rest api' ) );
+
+ copyRestFeature( this, hasFeature( 'rest api' ) );
+
+ copyTemplate( this, 'buildtool/gradle-app.tmpl', 'app/build.gradle' );
+ copyTemplate( this, 'buildtool/gradle-bootstrap.tmpl', 'bootstrap/build.gradle' );
+ copyTemplate( this, 'buildtool/gradle-model.tmpl', 'model/build.gradle' );
+ copyTemplate( this, 'buildtool/gradle-rest.tmpl', 'rest/build.gradle' );
+ copyTemplate( this, 'buildtool/gradle-root.tmpl', 'build.gradle' );
+ copyTemplate( this, 'buildtool/settings.tmpl', 'settings.gradle' );
+ copyTemplate( this, 'buildtool/gradlew.tmpl', 'gradlew' );
+ copyTemplate( this, 'buildtool/gradlew-bat.tmpl', 'gradlew.bat' );
+ this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.jar_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.jar' ) );
+ this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.properties_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.properties' ) );
+ }
+ }
+);
+
+function copyPolygeneBootstrap( ctx, layer, moduleName, condition )
+{
+ if( condition )
+ {
+ copyTemplate( ctx,
+ moduleName + '/bootstrap.tmpl',
+ 'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + layer + '/' + moduleName + '.java' );
+ }
+}
+
+function copyEntityStore( ctx, entityStoreName )
+{
+ copyTemplate( ctx,
+ 'StorageModule/bootstrap.tmpl',
+ 'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/infrastructure/' + entityStoreName + 'StorageModule.java' );
+}
+
+function copyPolygeneApp( ctx, name, condition )
+{
+ if( condition )
+ {
+ copyTemplate( ctx,
+ name + '/bootstrap.tmpl',
+ 'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + name + 'ApplicationAssembler.java' );
+
+ copyTemplate( ctx,
+ name + '/app.tmpl',
+ 'app/src/main/java/' + polygene.javaPackageDir + '/app/' + name + '.java' );
+
+ copyTemplate( ctx,
+ name + '/webapp/',
+ 'app/src/main/webapp/' );
+ }
+}
+
+function copyPolygeneDomain( ctx, model, module, clazz, condition )
+{
+ if( condition )
+ {
+ copyTemplate( ctx,
+ module + '/' + clazz + '.tmpl',
+ 'model/src/main/java/' + polygene.javaPackageDir + '/model/' + model + '/' + clazz + '.java' );
+ }
+}
+
+function copyRestFeature( ctx, condition )
+{
+ if( condition )
+ {
+ copyPolygeneBootstrap( ctx, "domain", "SecurityModule", true );
+
+ copyTemplate( ctx,
+ 'RestApiModule/SimpleEnroler.tmpl',
+ 'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleEnroler.java' );
+
+ copyTemplate( ctx,
+ 'RestApiModule/SimpleVerifier.tmpl',
+ 'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleVerifier.java' );
+
+ copyTemplate( ctx,
+ 'RestApiModule/HardcodedSecurityRepositoryMixin.tmpl',
+ 'model/src/main/java/' + polygene.javaPackageDir + '/model/security/HardcodedSecurityRepositoryMixin.java' );
+ }
+}
+
+function copyHeroesSampleApp( ctx )
+{
+ copyPolygeneDomain( ctx, "heroes", "Heroes", "Hero", hasFeature( 'sample (heroes) web application' ) );
+ copyPolygeneApp( ctx, "Heroes", hasFeature( 'sample (heroes) web application' ) );
+ copyTemplate( ctx,
+ 'Heroes/web.tmpl',
+ 'app/src/main/webapp/WEB-INF/web.xml' );
+}
+
+function copyTemplate( ctx, from, to )
+{
+ ctx.fs.copyTpl(
+ ctx.templatePath( from ),
+ ctx.destinationPath( to ),
+ {
+ packageName: polygene.packagename,
+ hasFeature: hasFeature,
+ hasEntityStore: hasEntityStore,
+ hasIndexing: hasIndexing,
+ hasCaching: hasCaching,
+ polygene: polygene
+ }
+ );
+}
+
+function hasEntityStore( esType )
+{
+ return polygene.entitystore === esType;
+}
+
+function hasIndexing( indexingType )
+{
+ return polygene.indexing === indexingType;
+}
+
+function hasCaching( cachingType )
+{
+ return polygene.caching === cachingType;
+}
+
+function hasSerialization( serializer )
+{
+ return polygene.serialization === serializer;
+}
+
+function hasFeature( feature )
+{
+ return polygene.features.indexOf( feature ) >= 0;
+}
+
+function firstUpper( text )
+{
+ return text.charAt( 0 ).toUpperCase() + text.substring( 1 );
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/ConfigModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConfigModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConfigModule/bootstrap.tmpl
new file mode 100644
index 0000000..b152d3a
--- /dev/null
+++ b/tools/generator-polygene/app/templates/ConfigModule/bootstrap.tmpl
@@ -0,0 +1,41 @@
+<%#
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+-%>
+package <%= packageName %>.bootstrap.config;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
+import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
+
+public class ConfigModule
+ implements ModuleAssembler
+{
+ @Override
+ public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+ throws AssemblyException
+ {
+ module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.layer );
+ new JacksonValueSerializationAssembler().visibleIn( Visibility.layer ).assemble( module );
+ return module;
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl
new file mode 100644
index 0000000..bb81a83
--- /dev/null
+++ b/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl
@@ -0,0 +1,46 @@
+<%#
+ * 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 <%= packageName %>.bootstrap.config;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class ConfigurationLayer extends LayeredLayerAssembler
+ implements LayerAssembler
+{
+ public static String NAME;
+ private ModuleAssembly configModule;
+
+ @Override
+ public LayerAssembly assemble( LayerAssembly layer )
+ throws AssemblyException
+ {
+ configModule = createModule( layer, ConfigModule.class );
+ return layer;
+ }
+
+ public ModuleAssembly configModule()
+ {
+ return configModule;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl
new file mode 100644
index 0000000..941e77e
--- /dev/null
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl
@@ -0,0 +1,41 @@
+<%#
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+-%>
+package <%= packageName %>.bootstrap.connectivity;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class ConnectivityLayer extends LayeredLayerAssembler
+ implements LayerAssembler
+{
+ public static String NAME;
+
+ @Override
+ public LayerAssembly assemble( LayerAssembly layer )
+ throws AssemblyException
+ {
+<% if( hasFeature('rest api') ) { %>
+ createModule( layer, RestApiModule.class );
+<% } -%>
+ return layer;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/CrudModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/CrudModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/CrudModule/bootstrap.tmpl
new file mode 100644
index 0000000..0877723
--- /dev/null
+++ b/tools/generator-polygene/app/templates/CrudModule/bootstrap.tmpl
@@ -0,0 +1,38 @@
+<%#
+ * 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 <%= packageName %>.bootstrap.domain;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.library.restlet.assembly.CrudServiceAssembler;
+
+public class CrudModule
+ implements ModuleAssembler
+{
+ @Override
+ public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+ throws AssemblyException
+ {
+ new CrudServiceAssembler().assemble( module );
+ return module;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
new file mode 100644
index 0000000..6285025
--- /dev/null
+++ b/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
@@ -0,0 +1,46 @@
+<%#
+ * 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 <%= packageName %>.bootstrap.domain;
+
+import java.util.function.Function;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class DomainLayer extends LayeredLayerAssembler
+ implements LayerAssembler
+{
+ @Override
+ public LayerAssembly assemble(LayerAssembly layer)
+ throws AssemblyException
+ {
+ createModule( layer, CrudModule.class );
+ createModule( layer, SecurityModule.class );
+ return layer;
+ }
+
+ public static Function<Application, Module> typeFinder()
+ {
+ return application -> application.findModule( "Domain Layer", "Assets Module" );
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/FileConfigurationModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/FileConfigurationModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/FileConfigurationModule/bootstrap.tmpl
new file mode 100644
index 0000000..ab2ad2c
--- /dev/null
+++ b/tools/generator-polygene/app/templates/FileConfigurationModule/bootstrap.tmpl
@@ -0,0 +1,41 @@
+<%#
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+-%>
+package <%= packageName %>.bootstrap.infrastructure;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
+
+public class FileConfigurationModule
+ implements ModuleAssembler
+{
+ public static String NAME;
+
+ @Override
+ public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+ throws AssemblyException
+ {
+ new FileConfigurationAssembler().visibleIn( Visibility.layer ).assemble( module );
+ return module;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/Hero.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/Hero.tmpl b/tools/generator-polygene/app/templates/Heroes/Hero.tmpl
new file mode 100644
index 0000000..c3c7ec9
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/Hero.tmpl
@@ -0,0 +1,28 @@
+<%#
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+-%>
+package <%= packageName %>.model.heroes;
+
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.property.Property;
+
+public interface Hero extends HasIdentity
+{
+ Property<String> name();
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/app.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/app.tmpl b/tools/generator-polygene/app/templates/Heroes/app.tmpl
new file mode 100644
index 0000000..4878f81
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/app.tmpl
@@ -0,0 +1,103 @@
+<%#
+ * 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 <%= packageName %>.app;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.layered.LayeredApplicationAssembler;
+import org.apache.polygene.library.restlet.ZrestApplication;
+import org.restlet.Context;
+import org.restlet.routing.Filter;
+import org.restlet.routing.Router;
+import org.restlet.security.Enroler;
+import org.restlet.security.Verifier;
+
+import <%= packageName %>.bootstrap.HeroesApplicationAssembler;
+import <%= packageName %>.bootstrap.connectivity.ConnectivityLayer;
+import <%= packageName %>.bootstrap.connectivity.RestApiModule;
+import <%= packageName %>.model.heroes.Hero;
+import <%= packageName %>.rest.security.SimpleEnroler;
+import <%= packageName %>.rest.security.SimpleVerifier;
+
+public class Heroes extends ZrestApplication
+{
+
+ public Heroes( Context context )
+ throws AssemblyException
+ {
+ super( context );
+ }
+
+ @Override
+ protected void addRoutes( Router router )
+ {
+ addResourcePath( "heroes", Hero.class, "/" );
+ }
+
+ @Override
+ protected LayeredApplicationAssembler createApplicationAssembler( String mode )
+ throws AssemblyException
+ {
+ if( mode != null )
+ {
+ return new HeroesApplicationAssembler( Application.Mode.valueOf( mode ) );
+ }
+ return new HeroesApplicationAssembler( Application.Mode.production );
+ }
+
+ @Override
+ protected Verifier createVerifier()
+ {
+ return newObject( SimpleVerifier.class );
+ }
+
+ @Override
+ protected Enroler createEnroler()
+ {
+ return newObject( SimpleEnroler.class, this );
+ }
+
+ @Override
+ protected String getConnectivityLayer()
+ {
+ return ConnectivityLayer.NAME;
+ }
+
+ @Override
+ protected String getConnectivityModule()
+ {
+ return RestApiModule.NAME;
+ }
+
+ private <T> T newObject( Class<T> type, Object... uses )
+ {
+ try
+ {
+ T instamce = type.newInstance();
+ objectFactory.injectTo( instamce, uses );
+ return instamce;
+ }
+ catch( Exception e )
+ {
+ throw new UndeclaredThrowableException( e );
+ }
+ }
+}
\ No newline at end of file