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:57 UTC
[81/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ;
Rename of everything else from zest to polygene.
ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/e0e1d7d4
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/e0e1d7d4
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/e0e1d7d4
Branch: refs/heads/develop
Commit: e0e1d7d4fa303d1d5e3ced606f4c62ac9d7bf9c5
Parents: e08a8d8
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Sat Dec 17 17:23:21 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Sat Dec 17 17:23:27 2016 +0800
----------------------------------------------------------------------
.../apache/polygene/gradle/doc/XsltTask.groovy | 11 +-
.../gradle/release/ModuleReleaseSpec.groovy | 23 +-
.../org/apache/zest/gradle/doc/XsltTask.groovy | 100 -----
.../gradle/release/ModuleReleaseSpec.groovy | 53 ---
.../gradle/release/ModuleReleaseSpecTest.groovy | 118 ++++++
.../gradle/release/ModuleReleaseSpecTest.groovy | 118 ------
.../composite/InterfaceDefaultMethodsTest.java | 12 +-
.../polygene/test/indexing/model/Address.java | 2 +-
.../polygene/library/appbrowser/Browser.java | 109 +++++
.../library/appbrowser/BrowserException.java | 29 ++
.../polygene/library/appbrowser/Formatter.java | 34 ++
.../library/appbrowser/FormatterFactory.java | 25 ++
.../appbrowser/json/AbstractJsonFormatter.java | 85 ++++
.../json/ApplicationModelFormatter.java | 56 +++
.../library/appbrowser/json/ArrayFormatter.java | 56 +++
.../json/CompositeMethodModelFormatter.java | 54 +++
.../json/ConstructorModelFormatter.java | 53 +++
.../appbrowser/json/EntityModelFormatter.java | 56 +++
.../json/InjectedFieldModelFormatter.java | 60 +++
.../appbrowser/json/JsonFormatterFactory.java | 107 +++++
.../appbrowser/json/LayerModelFormatter.java | 62 +++
.../appbrowser/json/MixinModelFormatter.java | 53 +++
.../appbrowser/json/ModuleModelFormatter.java | 54 +++
.../library/appbrowser/json/NullFormatter.java | 48 +++
.../appbrowser/json/ObjectModelFormatter.java | 53 +++
.../appbrowser/json/ServiceModelFormatter.java | 61 +++
.../appbrowser/json/ValueModelFormatter.java | 55 +++
.../apache/zest/library/appbrowser/Browser.java | 109 -----
.../library/appbrowser/BrowserException.java | 29 --
.../zest/library/appbrowser/Formatter.java | 34 --
.../library/appbrowser/FormatterFactory.java | 25 --
.../appbrowser/json/AbstractJsonFormatter.java | 85 ----
.../json/ApplicationModelFormatter.java | 56 ---
.../library/appbrowser/json/ArrayFormatter.java | 56 ---
.../json/CompositeMethodModelFormatter.java | 54 ---
.../json/ConstructorModelFormatter.java | 53 ---
.../appbrowser/json/EntityModelFormatter.java | 56 ---
.../json/InjectedFieldModelFormatter.java | 60 ---
.../appbrowser/json/JsonFormatterFactory.java | 107 -----
.../appbrowser/json/LayerModelFormatter.java | 62 ---
.../appbrowser/json/MixinModelFormatter.java | 53 ---
.../appbrowser/json/ModuleModelFormatter.java | 54 ---
.../library/appbrowser/json/NullFormatter.java | 48 ---
.../appbrowser/json/ObjectModelFormatter.java | 53 ---
.../appbrowser/json/ServiceModelFormatter.java | 61 ---
.../appbrowser/json/ValueModelFormatter.java | 55 ---
.../library/appbrowser/AppBrowserTest.java | 167 ++++++++
.../zest/library/appbrowser/AppBrowserTest.java | 167 --------
.../http/VirtualHostJettyServiceTest.java | 91 +++++
.../library/http/dns/LocalManagedDns.java | 125 ++++++
.../http/dns/LocalManagedDnsDescriptor.java | 48 +++
.../http/VirtualHostJettyServiceTest.java | 91 -----
.../zest/library/http/dns/LocalManagedDns.java | 125 ------
.../http/dns/LocalManagedDnsDescriptor.java | 48 ---
...un.net.spi.nameservice.NameServiceDescriptor | 2 +-
.../jdbm/JdbmEntityStorePerformanceTest.java | 72 ++++
.../MemoryEntityStorePerformanceTest.java | 60 +++
.../sql/DerbySQLEntityStorePerformanceTest.java | 126 ++++++
.../PostgreSQLEntityStorePerformanceTest.java | 154 +++++++
.../indexing/rdf/QueryPerformanceTest.java | 399 +++++++++++++++++++
.../CompositeCreationPerformanceTest.java | 287 +++++++++++++
.../composite/InvocationPerformanceTest.java | 204 ++++++++++
.../PropertyMixinInvocationPerformanceTest.java | 134 +++++++
.../object/ObjectCreationPerformanceTest.java | 71 ++++
.../ServiceInvocationPerformanceTest.java | 113 ++++++
.../jdbm/JdbmEntityStorePerformanceTest.java | 72 ----
.../MemoryEntityStorePerformanceTest.java | 60 ---
.../sql/DerbySQLEntityStorePerformanceTest.java | 126 ------
.../PostgreSQLEntityStorePerformanceTest.java | 154 -------
.../indexing/rdf/QueryPerformanceTest.java | 399 -------------------
.../CompositeCreationPerformanceTest.java | 287 -------------
.../composite/InvocationPerformanceTest.java | 204 ----------
.../PropertyMixinInvocationPerformanceTest.java | 134 -------
.../object/ObjectCreationPerformanceTest.java | 71 ----
.../ServiceInvocationPerformanceTest.java | 113 ------
.../jdbm/JdbmEntityStoreService.properties | 25 ++
.../rdf/repository/rdf-indexing.properties | 22 +
.../jdbm/JdbmEntityStoreService.properties | 25 --
.../rdf/repository/rdf-indexing.properties | 22 -
tools/generator-polygene/app/index.js | 317 +++++++++++++++
.../app/templates/ConfigModule/bootstrap.tmpl | 41 ++
.../templates/ConfigurationLayer/bootstrap.tmpl | 46 +++
.../templates/ConnectivityLayer/bootstrap.tmpl | 41 ++
.../app/templates/CrudModule/bootstrap.tmpl | 38 ++
.../app/templates/DomainLayer/bootstrap.tmpl | 46 +++
.../FileConfigurationModule/bootstrap.tmpl | 41 ++
.../app/templates/Heroes/Hero.tmpl | 28 ++
.../app/templates/Heroes/app.tmpl | 103 +++++
.../app/templates/Heroes/bootstrap.tmpl | 68 ++++
.../app/templates/Heroes/web.tmpl | 54 +++
.../Heroes/webapp/app/app.component.css | 34 ++
.../Heroes/webapp/app/app.component.js | 41 ++
.../Heroes/webapp/app/app.component.js.map | 1 +
.../Heroes/webapp/app/app.component.ts | 37 ++
.../Heroes/webapp/app/dashboard.component.css | 67 ++++
.../Heroes/webapp/app/dashboard.component.html | 15 +
.../Heroes/webapp/app/dashboard.component.js | 38 ++
.../webapp/app/dashboard.component.js.map | 1 +
.../Heroes/webapp/app/dashboard.component.ts | 31 ++
.../Heroes/webapp/app/hero-detail.component.css | 36 ++
.../webapp/app/hero-detail.component.html | 16 +
.../Heroes/webapp/app/hero-detail.component.js | 37 ++
.../webapp/app/hero-detail.component.js.map | 1 +
.../Heroes/webapp/app/hero-detail.component.ts | 34 ++
.../app/templates/Heroes/webapp/app/hero.js | 13 +
.../app/templates/Heroes/webapp/app/hero.js.map | 1 +
.../templates/Heroes/webapp/app/hero.service.js | 30 ++
.../Heroes/webapp/app/hero.service.js.map | 1 +
.../templates/Heroes/webapp/app/hero.service.ts | 22 +
.../app/templates/Heroes/webapp/app/hero.ts | 11 +
.../Heroes/webapp/app/heroes.component.css | 66 +++
.../Heroes/webapp/app/heroes.component.html | 21 +
.../Heroes/webapp/app/heroes.component.js | 42 ++
.../Heroes/webapp/app/heroes.component.js.map | 1 +
.../Heroes/webapp/app/heroes.component.ts | 39 ++
.../app/templates/Heroes/webapp/app/main.js | 15 +
.../app/templates/Heroes/webapp/app/main.js.map | 1 +
.../app/templates/Heroes/webapp/app/main.ts | 16 +
.../templates/Heroes/webapp/app/mock-heroes.js | 19 +
.../Heroes/webapp/app/mock-heroes.js.map | 1 +
.../templates/Heroes/webapp/app/mock-heroes.ts | 21 +
.../app/templates/Heroes/webapp/index.html | 41 ++
.../app/templates/Heroes/webapp/styles.css | 149 +++++++
.../InfrastructureLayer/bootstrap.tmpl | 55 +++
.../JacksonSerializationModule/bootstrap.tmpl | 53 +++
.../templates/NoCachingModule/bootstrap.tmpl | 46 +++
.../templates/RDFIndexingModule/bootstrap.tmpl | 50 +++
.../HardcodedSecurityRepositoryMixin.tmpl | 54 +++
.../RestApiModule/SecurityRepository.tmpl | 36 ++
.../templates/RestApiModule/SimpleEnroler.tmpl | 52 +++
.../templates/RestApiModule/SimpleVerifier.tmpl | 46 +++
.../app/templates/RestApiModule/bootstrap.tmpl | 56 +++
.../HardcodedSecurityRepositoryMixin.tmpl | 51 +++
.../SecurityModule/SecurityRepository.tmpl | 35 ++
.../app/templates/SecurityModule/bootstrap.tmpl | 46 +++
.../app/templates/StorageModule/bootstrap.tmpl | 51 +++
.../app/templates/buildtool/gradle-app.tmpl | 41 ++
.../templates/buildtool/gradle-bootstrap.tmpl | 36 ++
.../app/templates/buildtool/gradle-model.tmpl | 23 ++
.../app/templates/buildtool/gradle-rest.tmpl | 27 ++
.../app/templates/buildtool/gradle-root.tmpl | 46 +++
.../app/templates/buildtool/gradle-wrapper.jar_ | Bin 0 -> 51348 bytes
.../buildtool/gradle-wrapper.properties_ | 24 ++
.../app/templates/buildtool/gradlew-bat.tmpl | 109 +++++
.../app/templates/buildtool/gradlew.tmpl | 183 +++++++++
.../app/templates/buildtool/settings.tmpl | 41 ++
tools/generator-polygene/package.json | 14 +
tools/generator-zest/app/index.js | 317 ---------------
.../app/templates/ConfigModule/bootstrap.tmpl | 41 --
.../templates/ConfigurationLayer/bootstrap.tmpl | 46 ---
.../templates/ConnectivityLayer/bootstrap.tmpl | 41 --
.../app/templates/CrudModule/bootstrap.tmpl | 38 --
.../app/templates/DomainLayer/bootstrap.tmpl | 46 ---
.../FileConfigurationModule/bootstrap.tmpl | 41 --
.../app/templates/Heroes/Hero.tmpl | 28 --
.../app/templates/Heroes/app.tmpl | 103 -----
.../app/templates/Heroes/bootstrap.tmpl | 68 ----
.../app/templates/Heroes/web.tmpl | 54 ---
.../Heroes/webapp/app/app.component.css | 34 --
.../Heroes/webapp/app/app.component.js | 41 --
.../Heroes/webapp/app/app.component.js.map | 1 -
.../Heroes/webapp/app/app.component.ts | 37 --
.../Heroes/webapp/app/dashboard.component.css | 67 ----
.../Heroes/webapp/app/dashboard.component.html | 15 -
.../Heroes/webapp/app/dashboard.component.js | 38 --
.../webapp/app/dashboard.component.js.map | 1 -
.../Heroes/webapp/app/dashboard.component.ts | 31 --
.../Heroes/webapp/app/hero-detail.component.css | 36 --
.../webapp/app/hero-detail.component.html | 16 -
.../Heroes/webapp/app/hero-detail.component.js | 37 --
.../webapp/app/hero-detail.component.js.map | 1 -
.../Heroes/webapp/app/hero-detail.component.ts | 34 --
.../app/templates/Heroes/webapp/app/hero.js | 13 -
.../app/templates/Heroes/webapp/app/hero.js.map | 1 -
.../templates/Heroes/webapp/app/hero.service.js | 30 --
.../Heroes/webapp/app/hero.service.js.map | 1 -
.../templates/Heroes/webapp/app/hero.service.ts | 22 -
.../app/templates/Heroes/webapp/app/hero.ts | 11 -
.../Heroes/webapp/app/heroes.component.css | 66 ---
.../Heroes/webapp/app/heroes.component.html | 21 -
.../Heroes/webapp/app/heroes.component.js | 42 --
.../Heroes/webapp/app/heroes.component.js.map | 1 -
.../Heroes/webapp/app/heroes.component.ts | 39 --
.../app/templates/Heroes/webapp/app/main.js | 15 -
.../app/templates/Heroes/webapp/app/main.js.map | 1 -
.../app/templates/Heroes/webapp/app/main.ts | 16 -
.../templates/Heroes/webapp/app/mock-heroes.js | 19 -
.../Heroes/webapp/app/mock-heroes.js.map | 1 -
.../templates/Heroes/webapp/app/mock-heroes.ts | 21 -
.../app/templates/Heroes/webapp/index.html | 41 --
.../app/templates/Heroes/webapp/styles.css | 149 -------
.../InfrastructureLayer/bootstrap.tmpl | 55 ---
.../JacksonSerializationModule/bootstrap.tmpl | 53 ---
.../templates/NoCachingModule/bootstrap.tmpl | 46 ---
.../templates/RdfIndexingModule/bootstrap.tmpl | 50 ---
.../HardcodedSecurityRepositoryMixin.tmpl | 54 ---
.../RestApiModule/SecurityRepository.tmpl | 36 --
.../templates/RestApiModule/SimpleEnroler.tmpl | 52 ---
.../templates/RestApiModule/SimpleVerifier.tmpl | 46 ---
.../app/templates/RestApiModule/bootstrap.tmpl | 56 ---
.../HardcodedSecurityRepositoryMixin.tmpl | 51 ---
.../SecurityModule/SecurityRepository.tmpl | 35 --
.../app/templates/SecurityModule/bootstrap.tmpl | 46 ---
.../app/templates/StorageModule/bootstrap.tmpl | 51 ---
.../app/templates/buildtool/gradle-app.tmpl | 41 --
.../templates/buildtool/gradle-bootstrap.tmpl | 36 --
.../app/templates/buildtool/gradle-model.tmpl | 23 --
.../app/templates/buildtool/gradle-rest.tmpl | 27 --
.../app/templates/buildtool/gradle-root.tmpl | 46 ---
.../app/templates/buildtool/gradle-wrapper.jar_ | Bin 51348 -> 0 bytes
.../buildtool/gradle-wrapper.properties_ | 24 --
.../app/templates/buildtool/gradlew-bat.tmpl | 109 -----
.../app/templates/buildtool/gradlew.tmpl | 183 ---------
.../app/templates/buildtool/settings.tmpl | 41 --
tools/generator-zest/package.json | 14 -
.../idea/PolygeneApplicationComponent.java | 133 +++++++
.../common/PolygeneAppliesToConstants.java | 33 ++
.../appliesTo/common/PolygeneAppliesToUtil.java | 138 +++++++
...ToAnnotationDeclaredCorrectlyInspection.java | 294 ++++++++++++++
.../AbstractCreateElementActionBase.java | 153 +++++++
.../actions/PolygeneCreateActionGroup.java | 82 ++++
.../plugin/idea/common/facet/PolygeneFacet.java | 50 +++
.../facet/PolygeneFacetConfiguration.java | 56 +++
.../idea/common/facet/PolygeneFacetType.java | 122 ++++++
.../common/facet/ui/PolygeneFacetEditorTab.java | 72 ++++
.../idea/common/inspections/AbstractFix.java | 51 +++
.../common/inspections/AbstractInspection.java | 62 +++
.../common/intentions/AbstractIntention.java | 132 ++++++
.../idea/common/psi/PsiAnnotationUtil.java | 97 +++++
.../plugin/idea/common/psi/PsiClassUtil.java | 134 +++++++
.../psi/search/GlobalSearchScopeUtil.java | 67 ++++
.../common/resource/PolygeneResourceBundle.java | 68 ++++
.../plugin/idea/common/vfs/VirtualFileUtil.java | 73 ++++
...teConcernFromMixinTypeOrCompositeAction.java | 62 +++
.../CreateConcernOfInPackageAction.java | 121 ++++++
.../common/PolygeneConcernConstants.java | 40 ++
.../concerns/common/PolygeneConcernUtil.java | 228 +++++++++++
...nsAnnotationDeclaredCorrectlyInspection.java | 175 ++++++++
.../intentions/add/AddConcernOnType.java | 140 +++++++
...larationOnFieldAndConstructorInspection.java | 92 +++++
...nAnnotationDeclarationOnFieldInspection.java | 141 +++++++
.../PolygeneInvocationAnnotationConstants.java | 32 ++
.../PolygeneInvocationAnnotationUtil.java | 129 ++++++
...onAnnotationDeclaredCorrectlyInspection.java | 121 ++++++
.../PolygeneServiceAnnotationConstants.java | 32 ++
.../common/PolygeneServiceAnnotationUtil.java | 99 +++++
...ceAnnotationDeclaredCorrectlyInspection.java | 112 ++++++
.../PolygeneStructureAnnotationConstants.java | 53 +++
.../common/PolygeneStructureAnnotationUtil.java | 124 ++++++
.../common/ReplaceWithStructureAnnotation.java | 49 +++
...reAnnotationDeclaredCorrectlyInspection.java | 92 +++++
.../mixins/common/PolygeneMixinConstants.java | 32 ++
.../idea/mixins/common/PolygeneMixinUtil.java | 196 +++++++++
.../inspections/MixinImplementsMixinType.java | 190 +++++++++
.../MixinsAnnotationDeclaredOnMixinType.java | 92 +++++
.../common/PolygeneSideEffectConstants.java | 35 ++
.../common/PolygeneSideEffectUtil.java | 188 +++++++++
...tsAnnotationDeclaredCorrectlyInspection.java | 177 ++++++++
.../idea/PolygeneApplicationComponent.java | 133 -------
.../common/PolygeneAppliesToConstants.java | 33 --
.../appliesTo/common/PolygeneAppliesToUtil.java | 138 -------
...ToAnnotationDeclaredCorrectlyInspection.java | 294 --------------
.../AbstractCreateElementActionBase.java | 153 -------
.../actions/PolygeneCreateActionGroup.java | 82 ----
.../plugin/idea/common/facet/PolygeneFacet.java | 50 ---
.../facet/PolygeneFacetConfiguration.java | 56 ---
.../idea/common/facet/PolygeneFacetType.java | 122 ------
.../common/facet/ui/PolygeneFacetEditorTab.java | 72 ----
.../idea/common/inspections/AbstractFix.java | 51 ---
.../common/inspections/AbstractInspection.java | 62 ---
.../common/intentions/AbstractIntention.java | 132 ------
.../idea/common/psi/PsiAnnotationUtil.java | 97 -----
.../plugin/idea/common/psi/PsiClassUtil.java | 134 -------
.../psi/search/GlobalSearchScopeUtil.java | 67 ----
.../common/resource/PolygeneResourceBundle.java | 68 ----
.../plugin/idea/common/vfs/VirtualFileUtil.java | 73 ----
...teConcernFromMixinTypeOrCompositeAction.java | 62 ---
.../CreateConcernOfInPackageAction.java | 121 ------
.../common/PolygeneConcernConstants.java | 40 --
.../concerns/common/PolygeneConcernUtil.java | 228 -----------
...nsAnnotationDeclaredCorrectlyInspection.java | 175 --------
.../intentions/add/AddConcernOnType.java | 140 -------
...larationOnFieldAndConstructorInspection.java | 92 -----
...nAnnotationDeclarationOnFieldInspection.java | 141 -------
.../PolygeneInvocationAnnotationConstants.java | 32 --
.../PolygeneInvocationAnnotationUtil.java | 129 ------
...onAnnotationDeclaredCorrectlyInspection.java | 121 ------
.../PolygeneServiceAnnotationConstants.java | 32 --
.../common/PolygeneServiceAnnotationUtil.java | 99 -----
...ceAnnotationDeclaredCorrectlyInspection.java | 112 ------
.../PolygeneStructureAnnotationConstants.java | 53 ---
.../common/PolygeneStructureAnnotationUtil.java | 124 ------
.../common/ReplaceWithStructureAnnotation.java | 49 ---
...reAnnotationDeclaredCorrectlyInspection.java | 92 -----
.../mixins/common/PolygeneMixinConstants.java | 32 --
.../idea/mixins/common/PolygeneMixinUtil.java | 196 ---------
.../inspections/MixinImplementsMixinType.java | 190 ---------
.../MixinsAnnotationDeclaredOnMixinType.java | 92 -----
.../common/PolygeneSideEffectConstants.java | 35 --
.../common/PolygeneSideEffectUtil.java | 188 ---------
...tsAnnotationDeclaredCorrectlyInspection.java | 177 --------
.../resource/PolygeneResourceBundle.properties | 164 ++++++++
.../resource/PolygeneResourceBundle.properties | 164 --------
303 files changed, 10983 insertions(+), 11132 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
index 19ee6e0..87c7937 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
@@ -19,9 +19,9 @@ package org.apache.polygene.gradle.doc
import groovy.transform.CompileStatic
import org.gradle.api.file.EmptyFileVisitor
+import org.gradle.api.tasks.Input
import org.gradle.api.tasks.SourceTask
import org.gradle.api.tasks.OutputDirectory
-import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.TaskAction
import org.gradle.api.file.FileVisitDetails
@@ -71,11 +71,10 @@ class XsltTask extends SourceTask
{
@OutputDirectory
- @Optional
File destDir
- @Optional
- String extension
+ @Input
+ String extension = 'html'
@InputFile
File stylesheetFile
@@ -92,10 +91,6 @@ class XsltTask extends SourceTask
{
// Remove the extension from the file name
def name = fvd.file.name.replaceAll( '[.][^\\.]*$', '' )
- if( extension == null )
- {
- extension = 'html'
- }
name += '.' + extension
def destFile = new File( destDir, name )
transformer.transform( new StreamSource( fvd.file ), new StreamResult( destFile ) )
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
index 13cbe09..c80c6bd 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
@@ -21,7 +21,7 @@ import org.gradle.api.Project
class ModuleReleaseSpec
{
- def boolean satisfiedBy( Project project )
+ boolean satisfiedBy( Project project )
{
def devStatusFile = new File( project.projectDir, "dev-status.xml" )
if( !devStatusFile.exists() )
@@ -29,12 +29,21 @@ class ModuleReleaseSpec
return false
}
def module = new XmlSlurper().parse( devStatusFile )
- def codebase = module.status.codebase.text()
- def docs = module.status.documentation.text()
- def tests = module.status.unittests.text()
- def satisfied = ( codebase == 'none' && docs == 'complete' && tests != 'complete' )
- satisfied |= ( codebase == 'early' && ( docs == 'complete' || docs == 'good') && (tests == 'complete' || tests == 'good' ) )
- satisfied |= ( codebase == 'beta' && (docs == 'complete' || docs == 'good' || docs == 'brief') && (tests == 'complete' || tests == 'good' || tests == 'some') )
+ def codebase = module.status.codebase.text() as String
+ def docs = module.status.documentation.text() as String
+ def tests = module.status.unittests.text() as String
+ return satisfiedBy( codebase, docs, tests )
+ }
+
+ boolean satisfiedBy( String codebase, String docs, String tests )
+ {
+ def satisfied = ( codebase == 'none' && docs == 'complete' )
+ satisfied |= ( codebase == 'early'
+ && ( docs == 'complete' || docs == 'good' )
+ && ( tests == 'complete' || tests == 'good' ) )
+ satisfied |= ( codebase == 'beta'
+ && ( docs == 'complete' || docs == 'good' || docs == 'brief' )
+ && ( tests == 'complete' || tests == 'good' || tests == 'some' ) )
satisfied |= ( codebase == 'stable' )
satisfied |= ( codebase == 'mature' )
// TODO Add a task to report this easily
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
deleted file mode 100644
index 333acf0..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
+++ /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.zest.gradle.doc
-
-import groovy.transform.CompileStatic
-import org.gradle.api.file.EmptyFileVisitor
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.SourceTask
-import org.gradle.api.tasks.OutputDirectory
-import org.gradle.api.tasks.InputFile
-import org.gradle.api.tasks.TaskAction
-import org.gradle.api.file.FileVisitDetails
-import javax.xml.transform.TransformerFactory
-import javax.xml.transform.stream.StreamResult
-import javax.xml.transform.stream.StreamSource
-
-/**
- * Gradle task for running a set of one or more
- * files through an XSLT transform. A styleSheet
- * file must be specified. The source file(s) are
- * configured just like any other source task:
- * source <file>
- * ...or...
- * source <directory>
- * ...and then optionally...
- * include '*.xml'
- * exclude, etc.
- *
- * One of destDir or destFile must be specified, though if
- * there are multiple source files then destFile will just
- * keep getting rewritten.
- *
- * The extension is stripped from the source files and the
- * specified extension is appended (whether it is set or not)
- * it defaults to no extension.
- *
- * Example task formatting a check style report:
- *
- * task checkstyleReport(type: XsltTask, dependsOn: check) {
- * source project.checkstyleResultsDir
- * include '*.xml'
- *
- * destDir = project.checkstyleResultsDir
- * extension = 'html'
- *
- * stylesheetFile = file( 'config/checkstyle/checkstyle-noframes.xsl' )
- * }
- *
- * The above definition requires that the specified XSL file be
- * copied in with the other checkstyle configuration files. (The
- * file in the example is part of the checkstyle distribution.)
- *
- */
-@CompileStatic
-class XsltTask extends SourceTask
-{
-
- @OutputDirectory
- File destDir
-
- @Input
- String extension = 'html'
-
- @InputFile
- File stylesheetFile
-
- @TaskAction
- def transform()
- {
- def factory = TransformerFactory.newInstance()
- def transformer = factory.newTransformer( new StreamSource( stylesheetFile ) );
-
- getSource().visit( new EmptyFileVisitor() {
- @Override
- void visitFile( FileVisitDetails fvd )
- {
- // Remove the extension from the file name
- def name = fvd.file.name.replaceAll( '[.][^\\.]*$', '' )
- name += '.' + extension
- def destFile = new File( destDir, name )
- transformer.transform( new StreamSource( fvd.file ), new StreamResult( destFile ) )
- }
- } )
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
deleted file mode 100644
index 199808a..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zest.gradle.release
-
-import org.gradle.api.Project
-
-class ModuleReleaseSpec
-{
- boolean satisfiedBy( Project project )
- {
- def devStatusFile = new File( project.projectDir, "dev-status.xml" )
- if( !devStatusFile.exists() )
- {
- return false
- }
- def module = new XmlSlurper().parse( devStatusFile )
- def codebase = module.status.codebase.text() as String
- def docs = module.status.documentation.text() as String
- def tests = module.status.unittests.text() as String
- return satisfiedBy( codebase, docs, tests )
- }
-
- boolean satisfiedBy( String codebase, String docs, String tests )
- {
- def satisfied = ( codebase == 'none' && docs == 'complete' )
- satisfied |= ( codebase == 'early'
- && ( docs == 'complete' || docs == 'good' )
- && ( tests == 'complete' || tests == 'good' ) )
- satisfied |= ( codebase == 'beta'
- && ( docs == 'complete' || docs == 'good' || docs == 'brief' )
- && ( tests == 'complete' || tests == 'good' || tests == 'some' ) )
- satisfied |= ( codebase == 'stable' )
- satisfied |= ( codebase == 'mature' )
- // TODO Add a task to report this easily
- // println "$project.name($satisfied) -> $codebase, $docs, $tests"
- return satisfied
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/test/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpecTest.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/test/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpecTest.groovy b/buildSrc/src/test/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpecTest.groovy
new file mode 100644
index 0000000..6ca353d
--- /dev/null
+++ b/buildSrc/src/test/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpecTest.groovy
@@ -0,0 +1,118 @@
+/*
+ * 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.gradle.release
+
+import spock.lang.Specification
+import spock.lang.Unroll
+
+class ModuleReleaseSpecTest extends Specification
+{
+ @Unroll
+ def "codebase(#code) docs(#docs) tests(#tests) -> #expected"()
+ {
+ expect:
+ new ModuleReleaseSpec().satisfiedBy( code, docs, tests ) == expected
+
+ where:
+ code | docs | tests | expected
+ 'none' | 'none' | 'none' | false
+ 'none' | 'none' | 'some' | false
+ 'none' | 'none' | 'good' | false
+ 'none' | 'none' | 'complete' | false
+ 'none' | 'brief' | 'none' | false
+ 'none' | 'brief' | 'some' | false
+ 'none' | 'brief' | 'good' | false
+ 'none' | 'brief' | 'complete' | false
+ 'none' | 'good' | 'none' | false
+ 'none' | 'good' | 'some' | false
+ 'none' | 'good' | 'good' | false
+ 'none' | 'good' | 'complete' | false
+ 'none' | 'complete' | 'none' | true
+ 'none' | 'complete' | 'some' | true
+ 'none' | 'complete' | 'good' | true
+ 'none' | 'complete' | 'complete' | true
+
+ 'early' | 'none' | 'none' | false
+ 'early' | 'none' | 'some' | false
+ 'early' | 'none' | 'good' | false
+ 'early' | 'none' | 'complete' | false
+ 'early' | 'brief' | 'none' | false
+ 'early' | 'brief' | 'some' | false
+ 'early' | 'brief' | 'good' | false
+ 'early' | 'brief' | 'complete' | false
+ 'early' | 'good' | 'none' | false
+ 'early' | 'good' | 'some' | false
+ 'early' | 'good' | 'good' | true
+ 'early' | 'good' | 'complete' | true
+ 'early' | 'complete' | 'none' | false
+ 'early' | 'complete' | 'some' | false
+ 'early' | 'complete' | 'good' | true
+ 'early' | 'complete' | 'complete' | true
+
+ 'beta' | 'none' | 'none' | false
+ 'beta' | 'none' | 'some' | false
+ 'beta' | 'none' | 'good' | false
+ 'beta' | 'none' | 'complete' | false
+ 'beta' | 'brief' | 'none' | false
+ 'beta' | 'brief' | 'some' | true
+ 'beta' | 'brief' | 'good' | true
+ 'beta' | 'brief' | 'complete' | true
+ 'beta' | 'good' | 'none' | false
+ 'beta' | 'good' | 'some' | true
+ 'beta' | 'good' | 'good' | true
+ 'beta' | 'good' | 'complete' | true
+ 'beta' | 'complete' | 'none' | false
+ 'beta' | 'complete' | 'some' | true
+ 'beta' | 'complete' | 'good' | true
+ 'beta' | 'complete' | 'complete' | true
+
+ 'stable' | 'none' | 'none' | true
+ 'stable' | 'none' | 'some' | true
+ 'stable' | 'none' | 'good' | true
+ 'stable' | 'none' | 'complete' | true
+ 'stable' | 'brief' | 'none' | true
+ 'stable' | 'brief' | 'some' | true
+ 'stable' | 'brief' | 'good' | true
+ 'stable' | 'brief' | 'complete' | true
+ 'stable' | 'good' | 'none' | true
+ 'stable' | 'good' | 'some' | true
+ 'stable' | 'good' | 'good' | true
+ 'stable' | 'good' | 'complete' | true
+ 'stable' | 'complete' | 'none' | true
+ 'stable' | 'complete' | 'some' | true
+ 'stable' | 'complete' | 'good' | true
+ 'stable' | 'complete' | 'complete' | true
+
+ 'mature' | 'none' | 'none' | true
+ 'mature' | 'none' | 'some' | true
+ 'mature' | 'none' | 'good' | true
+ 'mature' | 'none' | 'complete' | true
+ 'mature' | 'brief' | 'none' | true
+ 'mature' | 'brief' | 'some' | true
+ 'mature' | 'brief' | 'good' | true
+ 'mature' | 'brief' | 'complete' | true
+ 'mature' | 'good' | 'none' | true
+ 'mature' | 'good' | 'some' | true
+ 'mature' | 'good' | 'good' | true
+ 'mature' | 'good' | 'complete' | true
+ 'mature' | 'complete' | 'none' | true
+ 'mature' | 'complete' | 'some' | true
+ 'mature' | 'complete' | 'good' | true
+ 'mature' | 'complete' | 'complete' | true
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy b/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy
deleted file mode 100644
index edd22b9..0000000
--- a/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zest.gradle.release
-
-import spock.lang.Specification
-import spock.lang.Unroll
-
-class ModuleReleaseSpecTest extends Specification
-{
- @Unroll
- def "codebase(#code) docs(#docs) tests(#tests) -> #expected"()
- {
- expect:
- new ModuleReleaseSpec().satisfiedBy( code, docs, tests ) == expected
-
- where:
- code | docs | tests | expected
- 'none' | 'none' | 'none' | false
- 'none' | 'none' | 'some' | false
- 'none' | 'none' | 'good' | false
- 'none' | 'none' | 'complete' | false
- 'none' | 'brief' | 'none' | false
- 'none' | 'brief' | 'some' | false
- 'none' | 'brief' | 'good' | false
- 'none' | 'brief' | 'complete' | false
- 'none' | 'good' | 'none' | false
- 'none' | 'good' | 'some' | false
- 'none' | 'good' | 'good' | false
- 'none' | 'good' | 'complete' | false
- 'none' | 'complete' | 'none' | true
- 'none' | 'complete' | 'some' | true
- 'none' | 'complete' | 'good' | true
- 'none' | 'complete' | 'complete' | true
-
- 'early' | 'none' | 'none' | false
- 'early' | 'none' | 'some' | false
- 'early' | 'none' | 'good' | false
- 'early' | 'none' | 'complete' | false
- 'early' | 'brief' | 'none' | false
- 'early' | 'brief' | 'some' | false
- 'early' | 'brief' | 'good' | false
- 'early' | 'brief' | 'complete' | false
- 'early' | 'good' | 'none' | false
- 'early' | 'good' | 'some' | false
- 'early' | 'good' | 'good' | true
- 'early' | 'good' | 'complete' | true
- 'early' | 'complete' | 'none' | false
- 'early' | 'complete' | 'some' | false
- 'early' | 'complete' | 'good' | true
- 'early' | 'complete' | 'complete' | true
-
- 'beta' | 'none' | 'none' | false
- 'beta' | 'none' | 'some' | false
- 'beta' | 'none' | 'good' | false
- 'beta' | 'none' | 'complete' | false
- 'beta' | 'brief' | 'none' | false
- 'beta' | 'brief' | 'some' | true
- 'beta' | 'brief' | 'good' | true
- 'beta' | 'brief' | 'complete' | true
- 'beta' | 'good' | 'none' | false
- 'beta' | 'good' | 'some' | true
- 'beta' | 'good' | 'good' | true
- 'beta' | 'good' | 'complete' | true
- 'beta' | 'complete' | 'none' | false
- 'beta' | 'complete' | 'some' | true
- 'beta' | 'complete' | 'good' | true
- 'beta' | 'complete' | 'complete' | true
-
- 'stable' | 'none' | 'none' | true
- 'stable' | 'none' | 'some' | true
- 'stable' | 'none' | 'good' | true
- 'stable' | 'none' | 'complete' | true
- 'stable' | 'brief' | 'none' | true
- 'stable' | 'brief' | 'some' | true
- 'stable' | 'brief' | 'good' | true
- 'stable' | 'brief' | 'complete' | true
- 'stable' | 'good' | 'none' | true
- 'stable' | 'good' | 'some' | true
- 'stable' | 'good' | 'good' | true
- 'stable' | 'good' | 'complete' | true
- 'stable' | 'complete' | 'none' | true
- 'stable' | 'complete' | 'some' | true
- 'stable' | 'complete' | 'good' | true
- 'stable' | 'complete' | 'complete' | true
-
- 'mature' | 'none' | 'none' | true
- 'mature' | 'none' | 'some' | true
- 'mature' | 'none' | 'good' | true
- 'mature' | 'none' | 'complete' | true
- 'mature' | 'brief' | 'none' | true
- 'mature' | 'brief' | 'some' | true
- 'mature' | 'brief' | 'good' | true
- 'mature' | 'brief' | 'complete' | true
- 'mature' | 'good' | 'none' | true
- 'mature' | 'good' | 'some' | true
- 'mature' | 'good' | 'good' | true
- 'mature' | 'good' | 'complete' | true
- 'mature' | 'complete' | 'none' | true
- 'mature' | 'complete' | 'some' | true
- 'mature' | 'complete' | 'good' | true
- 'mature' | 'complete' | 'complete' | true
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
index e2aed7a..2d0a58f 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
@@ -101,7 +101,7 @@ public class InterfaceDefaultMethodsTest extends AbstractPolygeneTest
DefaultMethodsSideEffects.class );
}
- @Ignore( "ZEST-120" )
+ @Ignore( "POLYGENE-120" )
@Test
public void defaultMethods()
{
@@ -109,7 +109,7 @@ public class InterfaceDefaultMethodsTest extends AbstractPolygeneTest
assertThat( composite.sayHello( "John" ), equalTo( "Hello, John!" ) );
}
- @Ignore( "ZEST-120" )
+ @Ignore( "POLYGENE-120" )
@Test
public void overrideDefaultMethods()
{
@@ -117,7 +117,7 @@ public class InterfaceDefaultMethodsTest extends AbstractPolygeneTest
assertThat( composite.sayHello( "John" ), equalTo( "Hello, overridden John!" ) );
}
- @Ignore( "ZEST-120" )
+ @Ignore( "POLYGENE-120" )
@Test
public void mixinDefaultMethods()
{
@@ -125,7 +125,7 @@ public class InterfaceDefaultMethodsTest extends AbstractPolygeneTest
assertThat( composite.sayHello( "John" ), equalTo( "Hello, mixed in John!" ) );
}
- @Ignore( "ZEST-120" )
+ @Ignore( "POLYGENE-120" )
@Test
public void defaultMethodsConstraints()
{
@@ -140,14 +140,14 @@ public class InterfaceDefaultMethodsTest extends AbstractPolygeneTest
}
}
- @Ignore( "ZEST-120" )
+ @Ignore( "POLYGENE-120" )
@Test
public void defaultMethodsConcerns()
{
fail( "Test not implemented" );
}
- @Ignore( "ZEST-120" )
+ @Ignore( "POLYGENE-120" )
@Test
public void defaultMethodsSideEffects()
{
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/core/testsupport/src/main/java/org/apache/polygene/test/indexing/model/Address.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/indexing/model/Address.java b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/model/Address.java
index 8eed9b3..74fc845 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/indexing/model/Address.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/model/Address.java
@@ -22,7 +22,7 @@ package org.apache.polygene.test.indexing.model;
import org.apache.polygene.api.property.Property;
import org.apache.polygene.api.value.ValueComposite;
-public interface Address extends ValueComposite // necessary, @See ZEST-137
+public interface Address extends ValueComposite // necessary, @See POLYGENE-137
{
Property<String> line1();
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Browser.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Browser.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Browser.java
new file mode 100644
index 0000000..29c3d0f
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Browser.java
@@ -0,0 +1,109 @@
+/*
+ * 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.library.appbrowser;
+
+import java.util.Stack;
+import org.json.JSONException;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+
+public class Browser
+{
+ private final ApplicationDescriptor application;
+ private final FormatterFactory factory;
+ private final Stack<Formatter> stack = new Stack<>();
+
+ public Browser( ApplicationDescriptor application, FormatterFactory factory )
+ {
+ this.application = application;
+ this.factory = factory;
+ }
+
+ public void toJson()
+ throws BrowserException
+ {
+ application.accept( new HierarchicalVisitor<Object, Object, BrowserException>()
+ {
+ @Override
+ public boolean visitEnter( Object visited )
+ throws BrowserException
+ {
+ String simpleName = visited.getClass().getSimpleName();
+ Formatter formatter = factory.create( simpleName );
+ stack.push(formatter);
+ if( formatter == null )
+ {
+ System.err.println( "Unknown application component: " + visited.getClass() );
+ return false;
+ }
+ try
+ {
+ formatter.enter( visited );
+ }
+ catch( JSONException e )
+ {
+ throw new BrowserException( "Formatting failed.", e );
+ }
+ return true;
+ }
+
+ @Override
+ public boolean visitLeave( Object visited )
+ throws BrowserException
+ {
+ Formatter formatter = stack.pop();
+ if( formatter == null )
+ {
+ System.err.println( "Unknown application component: " + visited.getClass() );
+ return false;
+ }
+ try
+ {
+ formatter.leave( visited );
+ }
+ catch( JSONException e )
+ {
+ throw new BrowserException( "Formatting failed.", e );
+ }
+ return true;
+ }
+
+ @Override
+ public boolean visit( Object visited )
+ throws BrowserException
+ {
+ Formatter formatter = stack.peek();
+ if( formatter == null )
+ {
+ System.err.println( "Unknown application component: " + visited.getClass() );
+ return false;
+ }
+ try
+ {
+ formatter.visit( visited );
+ }
+ catch( JSONException e )
+ {
+ throw new BrowserException( "Formatting failed.", e );
+ }
+ return true;
+ }
+ } );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/BrowserException.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/BrowserException.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/BrowserException.java
new file mode 100644
index 0000000..126c198
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/BrowserException.java
@@ -0,0 +1,29 @@
+/*
+ * 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.library.appbrowser;
+
+import org.json.JSONException;
+
+public class BrowserException extends RuntimeException
+{
+ public BrowserException( String message, JSONException exception )
+ {
+ super( message, exception);
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Formatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Formatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Formatter.java
new file mode 100644
index 0000000..19355a7
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Formatter.java
@@ -0,0 +1,34 @@
+/*
+ * 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.library.appbrowser;
+
+import org.json.JSONException;
+
+public interface Formatter<NODE, LEAF>
+{
+
+ void enter( NODE visited )
+ throws JSONException;
+
+ void leave( NODE visited )
+ throws JSONException;
+
+ void visit( LEAF visited )
+ throws JSONException;
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/FormatterFactory.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/FormatterFactory.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/FormatterFactory.java
new file mode 100644
index 0000000..d996e2a
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/FormatterFactory.java
@@ -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.
+ */
+package org.apache.polygene.library.appbrowser;
+
+public interface FormatterFactory
+{
+
+ Formatter create( String componentType );
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/AbstractJsonFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/AbstractJsonFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/AbstractJsonFormatter.java
new file mode 100644
index 0000000..7682097
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/AbstractJsonFormatter.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public abstract class AbstractJsonFormatter<NODE,LEAF>
+ implements Formatter<NODE, LEAF>
+{
+ private final JSONWriter writer;
+
+ public AbstractJsonFormatter( JSONWriter writer )
+ {
+ this.writer = writer;
+ }
+
+ protected void field( String name, String value )
+ throws JSONException
+ {
+ writer.key( name ).value(value);
+ }
+
+ protected void field( String name, boolean value )
+ throws JSONException
+ {
+ writer.key( name ).value(value);
+ }
+
+ protected void array( String name )
+ throws JSONException
+ {
+ writer.key(name);
+ writer.array();
+ }
+
+ protected void endArray()
+ throws JSONException
+ {
+ writer.endArray();
+ }
+
+ protected void object()
+ throws JSONException
+ {
+ writer.object();
+ }
+
+ protected void object(String name)
+ throws JSONException
+ {
+ writer.key(name);
+ writer.object();
+ }
+
+ protected void endObject()
+ throws JSONException
+ {
+ writer.endObject();
+ }
+
+ protected void value( Object value )
+ throws JSONException
+ {
+ writer.value( value );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ApplicationModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ApplicationModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ApplicationModelFormatter.java
new file mode 100644
index 0000000..c862021
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ApplicationModelFormatter.java
@@ -0,0 +1,56 @@
+/*
+ * 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.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class ApplicationModelFormatter extends AbstractJsonFormatter<ApplicationDescriptor, Void>
+{
+
+ public ApplicationModelFormatter( JSONWriter writer )
+ {
+ super( writer );
+ }
+
+ @Override
+ public void enter( ApplicationDescriptor visited )
+ throws JSONException
+ {
+ object();
+ field( "name", visited.name() );
+ array("layers");
+ }
+
+ @Override
+ public void leave( ApplicationDescriptor visited )
+ throws JSONException
+ {
+ endArray();
+ endObject();
+ }
+
+ @Override
+ public void visit( Void visited )
+ throws JSONException
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ArrayFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ArrayFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ArrayFormatter.java
new file mode 100644
index 0000000..6c315d0
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ArrayFormatter.java
@@ -0,0 +1,56 @@
+/*
+ * 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.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class ArrayFormatter extends AbstractJsonFormatter
+ implements Formatter
+{
+ private final String name;
+
+ public ArrayFormatter( JSONWriter writer, String name )
+ {
+ super(writer);
+ this.name = name;
+ }
+
+ @Override
+ public void enter( Object visited )
+ throws JSONException
+ {
+ array(name);
+ }
+
+ @Override
+ public void leave( Object visited )
+ throws JSONException
+ {
+ endArray();
+ }
+
+ @Override
+ public void visit( Object visited )
+ throws JSONException
+ {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/CompositeMethodModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/CompositeMethodModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/CompositeMethodModelFormatter.java
new file mode 100644
index 0000000..e4328ea
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/CompositeMethodModelFormatter.java
@@ -0,0 +1,54 @@
+/*
+ * 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.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.composite.MethodDescriptor;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class CompositeMethodModelFormatter extends AbstractJsonFormatter<MethodDescriptor, Void>
+{
+ public CompositeMethodModelFormatter( JSONWriter writer )
+ {
+ super(writer);
+ }
+
+ @Override
+ public void enter( MethodDescriptor visited )
+ throws JSONException
+ {
+ object();
+ field("method", visited.method().getName() );
+ }
+
+ @Override
+ public void leave( MethodDescriptor visited )
+ throws JSONException
+ {
+ endObject();
+ }
+
+ @Override
+ public void visit( Void visited )
+ throws JSONException
+ {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ConstructorModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ConstructorModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ConstructorModelFormatter.java
new file mode 100644
index 0000000..8f864dd
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ConstructorModelFormatter.java
@@ -0,0 +1,53 @@
+/*
+ * 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.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.composite.ConstructorDescriptor;
+
+public class ConstructorModelFormatter extends AbstractJsonFormatter<ConstructorDescriptor,Void>
+{
+ public ConstructorModelFormatter( JSONWriter writer )
+ {
+ super( writer );
+ }
+
+ @Override
+ public void enter( ConstructorDescriptor visited )
+ throws JSONException
+ {
+ object();
+ field( "name", visited.constructor().getName() );
+ }
+
+ @Override
+ public void leave( ConstructorDescriptor visited )
+ throws JSONException
+ {
+ endObject();
+ }
+
+ @Override
+ public void visit( Void visited )
+ throws JSONException
+ {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/EntityModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/EntityModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/EntityModelFormatter.java
new file mode 100644
index 0000000..70d0d9e
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/EntityModelFormatter.java
@@ -0,0 +1,56 @@
+/*
+ * 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.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.entity.EntityDescriptor;
+
+public class EntityModelFormatter extends AbstractJsonFormatter<EntityDescriptor, Void>
+{
+
+ public EntityModelFormatter( JSONWriter writer )
+ {
+ super( writer );
+ }
+
+ @Override
+ public void enter( EntityDescriptor visited )
+ throws JSONException
+ {
+ object();
+ field( "type", visited.primaryType().getName() );
+ field( "visibility", visited.visibility().toString() );
+ field( "queryable", visited.queryable() );
+ }
+
+ @Override
+ public void leave( EntityDescriptor visited )
+ throws JSONException
+ {
+ endObject();
+ }
+
+ @Override
+ public void visit( Void visited )
+ throws JSONException
+ {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/InjectedFieldModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/InjectedFieldModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/InjectedFieldModelFormatter.java
new file mode 100644
index 0000000..75a216e
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/InjectedFieldModelFormatter.java
@@ -0,0 +1,60 @@
+/*
+ * 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.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.composite.DependencyDescriptor;
+import org.apache.polygene.api.composite.InjectedFieldDescriptor;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class InjectedFieldModelFormatter extends AbstractJsonFormatter<InjectedFieldDescriptor, DependencyDescriptor>
+{
+ public InjectedFieldModelFormatter( JSONWriter writer )
+ {
+ super(writer);
+ }
+
+ @Override
+ public void enter( InjectedFieldDescriptor visited )
+ throws JSONException
+ {
+ object();
+ field("name", visited.field().getName() );
+// field( "optional", visited.optional() );
+// field( "injectedclass", visited.injectedClass().getName() );
+// field( "injectedannotation", visited.injectionAnnotation().toString() );
+// field( "injectedtype", visited.injectionType().toString() );
+// field( "rawinjectectiontype", visited.rawInjectionType().getName() );
+ }
+
+ @Override
+ public void leave( InjectedFieldDescriptor visited )
+ throws JSONException
+ {
+ endObject();
+ }
+
+ @Override
+ public void visit( DependencyDescriptor visited )
+ throws JSONException
+ {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/JsonFormatterFactory.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/JsonFormatterFactory.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/JsonFormatterFactory.java
new file mode 100644
index 0000000..5c7748a
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/JsonFormatterFactory.java
@@ -0,0 +1,107 @@
+/*
+ * 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.library.appbrowser.json;
+
+import java.io.Writer;
+import org.json.JSONWriter;
+import org.apache.polygene.library.appbrowser.Formatter;
+import org.apache.polygene.library.appbrowser.FormatterFactory;
+
+public class JsonFormatterFactory
+ implements FormatterFactory
+{
+ private static final NullFormatter NULL_FORMATTER = new NullFormatter();
+ private final JSONWriter writer;
+
+ public JsonFormatterFactory(Writer destination)
+ {
+ writer = new JSONWriter( destination );
+ }
+
+ @Override
+ public Formatter create( String componentType )
+ {
+ if( componentType.equalsIgnoreCase( "ApplicationModel" ))
+ return new ApplicationModelFormatter( writer );
+ if( componentType.equalsIgnoreCase( "LayerModel" ))
+ return new LayerModelFormatter( writer );
+ if( componentType.equalsIgnoreCase( "ModuleModel" ))
+ return new ModuleModelFormatter( writer );
+ if( componentType.equalsIgnoreCase( "TransientsModel" ))
+ return new ArrayFormatter(writer, "transients");
+ if( componentType.equalsIgnoreCase( "EntitiesModel" ))
+ return new ArrayFormatter(writer, "entities");
+ if( componentType.equalsIgnoreCase( "ServicesModel" ))
+ return new ArrayFormatter(writer, "services");
+ if( componentType.equalsIgnoreCase( "ServiceModel" ))
+ return new ServiceModelFormatter
+ (writer);
+ if( componentType.equalsIgnoreCase( "ValuesModel" ))
+ return new ArrayFormatter(writer, "values");
+ if( componentType.equalsIgnoreCase( "ValueModel" ))
+ return new ValueModelFormatter(writer);
+ if( componentType.equalsIgnoreCase( "ValueStateModel" ))
+ return NULL_FORMATTER;
+ if( componentType.equalsIgnoreCase( "EntityModel" ))
+ return new EntityModelFormatter( writer );
+ if( componentType.equalsIgnoreCase( "CompositeMethodsModel" ))
+ return new ArrayFormatter( writer, "methods" );
+ if( componentType.equalsIgnoreCase( "CompositeMethodModel" ))
+ return new CompositeMethodModelFormatter(writer);
+ if( componentType.equalsIgnoreCase( "ObjectsModel" ))
+ return new ArrayFormatter( writer, "objects" );
+ if( componentType.equalsIgnoreCase( "ConstraintsModel" ))
+ return new ArrayFormatter( writer, "constraints" );
+ if( componentType.equalsIgnoreCase( "SideEffectsModel" ))
+ return new ArrayFormatter( writer, "sideeffects" );
+ if( componentType.equalsIgnoreCase( "ConcernsModel" ))
+ return new ArrayFormatter( writer, "concerns" );
+ if( componentType.equalsIgnoreCase( "PropertiesModel" ))
+ return new ArrayFormatter( writer, "properties" );
+ if( componentType.equalsIgnoreCase( "ConstructorsModel" ))
+ return new ArrayFormatter( writer, "constructors" );
+ if( componentType.equalsIgnoreCase( "ConstructorModel" ))
+ return new ConstructorModelFormatter( writer );
+ if( componentType.equalsIgnoreCase( "EntityMixinsModel" ))
+ return new ArrayFormatter( writer, "mixins" );
+ if( componentType.equalsIgnoreCase( "MixinsModel" ))
+ return new ArrayFormatter( writer, "mixins" );
+ if( componentType.equalsIgnoreCase( "MixinModel" ))
+ return new MixinModelFormatter( writer );
+ if( componentType.equalsIgnoreCase( "AssociationsModel" ))
+ return new ArrayFormatter( writer, "associations" );
+ if( componentType.equalsIgnoreCase( "ManyAssociationsModel" ))
+ return new ArrayFormatter( writer, "manyassociations" );
+ if( componentType.equalsIgnoreCase( "InjectedFieldsModel" ))
+ return new ArrayFormatter( writer, "injectedfields" );
+ if( componentType.equalsIgnoreCase( "InjectedFieldModel" ))
+ return new InjectedFieldModelFormatter(writer);
+ if( componentType.equalsIgnoreCase( "InjectedMethodsModel" ))
+ return new ArrayFormatter( writer, "injectedmethods" );
+ if( componentType.equalsIgnoreCase( "InjectedParametersModel" ))
+ return new ArrayFormatter( writer, "injectedparameters" );
+ if( componentType.equalsIgnoreCase( "EntityStateModel" ))
+ return NULL_FORMATTER;
+ if( componentType.equalsIgnoreCase( "ObjectModel" ))
+ return new ObjectModelFormatter(writer);
+ if( componentType.equalsIgnoreCase( "ImportedServicesModel" ))
+ return NULL_FORMATTER;
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/LayerModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/LayerModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/LayerModelFormatter.java
new file mode 100644
index 0000000..f55c475
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/LayerModelFormatter.java
@@ -0,0 +1,62 @@
+/*
+ * 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.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.structure.LayerDescriptor;
+import org.apache.polygene.api.structure.UsedLayersDescriptor;
+
+public class LayerModelFormatter extends AbstractJsonFormatter<LayerDescriptor, Void>
+{
+ public LayerModelFormatter( JSONWriter writer )
+ {
+ super( writer );
+ }
+
+ @Override
+ public void enter( LayerDescriptor visited )
+ throws JSONException
+ {
+ object();
+ field( "name", visited.name() );
+ array( "uses" );
+ UsedLayersDescriptor usedLayersDescriptor = visited.usedLayers();
+ for( LayerDescriptor used : usedLayersDescriptor.layers() )
+ {
+ value( used.name() );
+ }
+ endArray();
+ array( "modules" );
+ }
+
+ @Override
+ public void leave( LayerDescriptor visited )
+ throws JSONException
+ {
+ endArray();
+ endObject();
+ }
+
+ @Override
+ public void visit( Void visited )
+ throws JSONException
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/MixinModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/MixinModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/MixinModelFormatter.java
new file mode 100644
index 0000000..3254e58
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/MixinModelFormatter.java
@@ -0,0 +1,53 @@
+/*
+ * 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.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.mixin.MixinDescriptor;
+
+public class MixinModelFormatter extends AbstractJsonFormatter<MixinDescriptor, Void>
+{
+ public MixinModelFormatter( JSONWriter writer )
+ {
+ super( writer );
+ }
+
+ @Override
+ public void enter( MixinDescriptor visited )
+ throws JSONException
+ {
+ object();
+ field( "mixin", visited.mixinClass().getName() );
+ }
+
+ @Override
+ public void leave( MixinDescriptor visited )
+ throws JSONException
+ {
+ endObject();
+ }
+
+ @Override
+ public void visit( Void visited )
+ throws JSONException
+ {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ModuleModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ModuleModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ModuleModelFormatter.java
new file mode 100644
index 0000000..1ea5c34
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ModuleModelFormatter.java
@@ -0,0 +1,54 @@
+/*
+ * 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.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class ModuleModelFormatter extends AbstractJsonFormatter<ModuleDescriptor, Void>
+{
+
+ public ModuleModelFormatter( JSONWriter writer )
+ {
+ super( writer );
+ }
+
+ @Override
+ public void enter( ModuleDescriptor visited )
+ throws JSONException
+ {
+ object();
+ field( "name", visited.name() );
+ }
+
+ @Override
+ public void leave( ModuleDescriptor visited )
+ throws JSONException
+ {
+ endObject();
+ }
+
+ @Override
+ public void visit( Void visited )
+ throws JSONException
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/NullFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/NullFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/NullFormatter.java
new file mode 100644
index 0000000..6cb3e59
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/NullFormatter.java
@@ -0,0 +1,48 @@
+/*
+ * 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.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class NullFormatter
+ implements Formatter<Object, Object>
+{
+ @Override
+ public void enter( Object visited )
+ throws JSONException
+ {
+
+ }
+
+ @Override
+ public void leave( Object visited )
+ throws JSONException
+ {
+
+ }
+
+ @Override
+ public void visit( Object visited )
+ throws JSONException
+ {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ObjectModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ObjectModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ObjectModelFormatter.java
new file mode 100644
index 0000000..959edad
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ObjectModelFormatter.java
@@ -0,0 +1,53 @@
+/*
+ * 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.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.object.ObjectDescriptor;
+
+public class ObjectModelFormatter extends AbstractJsonFormatter<ObjectDescriptor, Void>
+{
+ public ObjectModelFormatter( JSONWriter writer )
+ {
+ super(writer);
+ }
+
+ @Override
+ public void enter( ObjectDescriptor visited )
+ throws JSONException
+ {
+ object();
+ field( "visibility", visited.visibility().toString());
+ }
+
+ @Override
+ public void leave( ObjectDescriptor visited )
+ throws JSONException
+ {
+ endObject();
+ }
+
+ @Override
+ public void visit( Void visited )
+ throws JSONException
+ {
+
+ }
+}