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 2017/07/10 06:53:30 UTC
[28/50] polygene-java git commit: Fixing the restlet library in
relation to the polygene generator to work.
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java
new file mode 100644
index 0000000..9977b93
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.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.restlet.assembly.infrastructue;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
+import org.apache.polygene.library.rdf.repository.NativeConfiguration;
+
+public class IndexingModule
+ implements ModuleAssembler
+{
+ public static final String NAME = "Indexing Module";
+ private final ModuleAssembly configModule;
+
+ public IndexingModule( ModuleAssembly configModule )
+ {
+ this.configModule = configModule;
+ }
+
+ @Override
+ public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+ {
+// new FileConfigurationAssembler().assemble( module );
+// new ESFilesystemIndexQueryAssembler()
+// .visibleIn( Visibility.application )
+// .withConfig( configModule, Visibility.application )
+// .assemble( module );
+
+ configModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application );
+ new RdfNativeSesameStoreAssembler(Visibility.application, Visibility.module).assemble( module );
+ return module;
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java
new file mode 100644
index 0000000..7d98ff3
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.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.restlet.assembly.infrastructue;
+
+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;
+import org.apache.polygene.library.restlet.assembly.configuration.ConfigurationLayer;
+import org.apache.polygene.library.restlet.assembly.configuration.ConfigurationModule;
+
+public class InfrastructureLayer extends LayeredLayerAssembler
+ implements LayerAssembler
+{
+ public static final String NAME = "Infrastructure Layer";
+ private final ModuleAssembly configModule;
+
+ public static InfrastructureLayer create( LayerAssembly layer )
+ {
+ ModuleAssembly config = layer.application().layer( ConfigurationLayer.NAME ).module( ConfigurationModule.NAME );
+ return new InfrastructureLayer( config );
+ }
+
+ public InfrastructureLayer( ModuleAssembly configModule )
+ {
+ this.configModule = configModule;
+ }
+
+ @Override
+ public LayerAssembly assemble( LayerAssembly layer )
+ {
+ new IndexingModule( configModule ).assemble( layer, layer.module( IndexingModule.NAME ) );
+ new SerializationModule().assemble( layer, layer.module( SerializationModule.NAME ) );
+ return layer;
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
new file mode 100644
index 0000000..85bb76d
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+
+package org.apache.polygene.library.restlet.assembly.infrastructue;
+
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+
+public class SerializationModule
+ implements ModuleAssembler
+{
+ public static final String NAME = "Serialization Module";
+
+ @Override
+ public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+ {
+ return module;
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java
new file mode 100644
index 0000000..a209315
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+
+package org.apache.polygene.library.restlet.assembly.resource;
+
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class ResourceLayer extends LayeredLayerAssembler
+ implements LayerAssembler
+{
+ public static final String NAME = "Resource Layer";
+
+ @Override
+ public LayerAssembly assemble( LayerAssembly layer )
+ {
+ return layer;
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
index d39b3c9..c7e161e 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
@@ -19,9 +19,7 @@
-%>
package <%= polygene.packageName %>.bootstrap.connectivity;
-import java.io.File;
import java.util.HashMap;
-import javax.servlet.Servlet;
<% if( hasFeature('security') ) { %>
import org.apache.polygene.library.http.SecureJettyConfiguration;
import org.apache.polygene.library.http.SecureJettyServiceAssembler;
@@ -36,7 +34,7 @@ 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.restlet.ext.servlet.ServerServlet;
+import org.apache.polygene.library.restlet.PolygeneServerServlet;
import <%= polygene.packageName %>.rest.<%= polygene.name %>RestApplication;
@@ -61,7 +59,6 @@ public class HttpServerModule
public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
throws AssemblyException
{
- module.services( Servlet.class ).withMixins( ServerServlet.class );
<% if( hasFeature('security') ) {
%> new HttpShiroAssembler()
.withConfig( module, Visibility.module );
@@ -89,7 +86,7 @@ public class HttpServerModule
defaults.port().set( DEFAULT_PORT );
HashMap<String, String> initParams = new HashMap<>();
initParams.put("org.restlet.application", <%= polygene.name %>RestApplication.class.getName() );
- addServlets( serve( "/" ).with(Servlet.class ).withInitParams( initParams ) ).to( module );
+ addServlets( serve( "/*" ).with(PolygeneServerServlet.class ).withInitParams( initParams ) ).to( module );
return module;
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl
deleted file mode 100644
index c24ddce..0000000
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl
+++ /dev/null
@@ -1,32 +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 <%= polygene.packageName %>.rest.security;
-
-import org.restlet.data.ClientInfo;
-import org.restlet.security.Enroler;
-
-public class NullEnroler
- implements Enroler
-{
- @Override
- public void enrole( ClientInfo clientInfo )
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl
deleted file mode 100644
index 5d6b349..0000000
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl
+++ /dev/null
@@ -1,34 +0,0 @@
-<%#
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
--%>
-package <%= polygene.packageName %>.rest.security;
-
-import org.restlet.security.SecretVerifier;
-import org.restlet.security.Verifier;
-
-public class NullVerifier extends SecretVerifier
- implements Verifier
-{
-
- @Override
- public int verify( String user, char[] secret )
- {
- return RESULT_VALID;
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
index 0594546..daa6755 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
@@ -18,14 +18,12 @@
*
-%>
package <%= polygene.packageName %>.bootstrap.connectivity;
-
<% if( hasFeature('security') ) { %>
import <%= polygene.packageName %>.rest.security.DefaultEnroler;
import <%= polygene.packageName %>.rest.security.DefaultVerifier;
-<% } else { %>
-import <%= polygene.packageName %>.rest.security.NullEnroler;
-import <%= polygene.packageName %>.rest.security.NullVerifier;
<% } %>
+import <%= polygene.packageName %>.rest.<%= polygene.name %>RestApplication;
+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;
@@ -44,10 +42,10 @@ public class RestApiModule
{
<% if( hasFeature('security') ) { %>
module.objects( DefaultVerifier.class, DefaultEnroler.class);
-<% } else {%>
- module.objects( NullVerifier.class, NullEnroler.class);
<% } %>
new RestletCrudConnectivityAssembler().assemble( module );
+ module.objects( <%= polygene.name %>RestApplication.class )
+ .visibleIn( Visibility.layer );
module.values( EntryPoint.class );
module.values( /* add value types */ );
module.services( /* add services */ );
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
index 8d4ad47..91e8104 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
@@ -27,10 +27,6 @@ module.exports = {
copyFile(p, "DefaultEnroler");
copyFile(p, "DefaultVerifier");
}
- else {
- copyFile(p, "NullEnroler");
- copyFile(p, "NullVerifier");
- }
}
}
};
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
index 5afbdd7..d23b640 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
@@ -23,6 +23,7 @@ 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.RestletCrudModuleAssembler;
<% for( var idx in polygene.current.cruds) {
%><%= "import " + polygene.packageName + ".model." + polygene.current.name + "." + polygene.current.cruds[idx].name + ";" %>
@@ -54,8 +55,7 @@ for( var idx in polygene.current.services) {
<%
} %>
-import static org.apache.polygene.api.common.Visibility.layer;
-import static org.apache.polygene.api.common.Visibility.application;
+import static org.apache.polygene.api.common.Visibility.*;
public class <%- firstUpper(polygene.current.name) %>Module
implements ModuleAssembler
@@ -69,8 +69,8 @@ if( polygene.current.cruds ) {
for( var value in polygene.current.cruds ) {
var crud = polygene.current.cruds[value];
%>
- <%- "module.values( " + crud.name + ".class )" + (crud.visibility ? ".visibleIn( " + crud.visibility +" )" : "" ) %>;
- <%- "module.entities( " + crud.name + ".class )" + (crud.visibility ? ".visibleIn( " + crud.visibility +" )" : "" ) %>;
+ new RestletCrudModuleAssembler( <%- crud.name %>.class )
+ .assemble( module );
<%
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/RestAPIApplication/application.java.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/application.java.tmpl b/tools/generator-polygene/app/templates/RestAPIApplication/application.java.tmpl
index 8b38091..e188755 100644
--- a/tools/generator-polygene/app/templates/RestAPIApplication/application.java.tmpl
+++ b/tools/generator-polygene/app/templates/RestAPIApplication/application.java.tmpl
@@ -38,19 +38,13 @@ if( hasFeature('security') ) {
%>import <%= polygene.packageName %>.rest.security.DefaultEnroler;
import <%= polygene.packageName %>.rest.security.DefaultVerifier;
<%
-} else {
-%>import <%= polygene.packageName %>.rest.security.NullEnroler;
-import <%= polygene.packageName %>.rest.security.NullVerifier;
-<%
}
%>
public class <%= polygene.name %>RestApplication extends PolygeneRestApplication
{
- private static final String BASEPATH = "/<%= polygene.name.toLowerCase() %>/";
-
- public <%= polygene.name %>RestApplication( Context context )
+ public <%= polygene.name %>RestApplication()
{
- super( context );
+ super( "/<%= polygene.name.toLowerCase() %>/", createContext() );
}
@Override
@@ -61,11 +55,18 @@ for( var moduleName in polygene.modules) {
var module = polygene.modules[moduleName];
for( var idx2 in module.cruds ) {
var crud = module.cruds[idx2];
-%> addResourcePath( "<%= crud.name.toLowerCase() %>", <%= crud.name %>.class, BASEPATH );
+%> addResourcePath( "<%= crud.name.toLowerCase() %>", <%= crud.name %>.class, basePath );
<%
}
}
-%> System.out.println( "REST API defined;" );
+%> }
+
+ @Override
+ public synchronized void start()
+ throws Exception
+ {
+ super.start();
+ System.out.println( "REST API defined;" );
printRoutes( System.out );
}
@@ -74,7 +75,8 @@ for( var moduleName in polygene.modules) {
<% if( hasFeature('security') ) {
%> return objectFactory.newObject(DefaultVerifier.class, this);
<% } else {
-%> return objectFactory.newObject(NullVerifier.class, this);
+%> // Security was not specified during generation, and Verifier is not needed.
+ return null;
<% }
%> }
@@ -83,7 +85,13 @@ for( var moduleName in polygene.modules) {
<% if( hasFeature('security') ) {
%> return objectFactory.newObject(DefaultEnroler.class, this);
<% } else {
-%> return objectFactory.newObject(NullEnroler.class, this);
+%> // Security was not specified during generation, and Enroler is not needed.
+ return null;
<% }
%> }
+
+ private static Context createContext()
+ {
+ return new Context("<%= polygene.packageName %>.rest");
+ }
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
index ad707f2..697a2b0 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
@@ -43,6 +43,7 @@ dependencies {
if( polygene.applicationtype === 'Rest API' ) {
%> implementation project( ":rest" )
implementation "org.apache.polygene.libraries:org.apache.polygene.library.restlet:$polygeneVersion"
+ runtimeOnly "org.restlet.jee:org.restlet.ext.servlet:$restletVersion"
<%
}
@@ -70,38 +71,37 @@ if( hasFeature( 'envisage' ) ) {
<%
}
if( polygene.entitystore == 'LevelDB' ) {
-%> implementation "org.fusesource.leveldbjni:leveldbjni-all:1.8"
+%> implementation "org.fusesource.leveldbjni:leveldbjni-all:$levelDbVersion"
<%
}
if( polygene.entitystore == 'DerbySQL' ) {
-%> implementation "org.apache.derby:derby:10.13.1.1"
+%> implementation "org.apache.derby:derby:$derbyVersion"
<%
}
if( polygene.entitystore == 'H2SQL' ) {
-%> implementation "com.h2database:h2:1.4.194"
+%> implementation "com.h2database:h2:$h2Version"
<%
}
if( polygene.entitystore == 'MySQL' ) {
-%> implementation "mysql:mysql-connector-java:6.0.6"
+%> implementation "mysql:mysql-connector-java:$mysqlVersion"
<%
}
if( polygene.entitystore == 'PostgreSQL' ) {
-%> implementation "org.postgresql:postgresql:42.0.0"
+%> implementation "org.postgresql:postgresql:$postgresVersion"
<%
}
if( polygene.entitystore == 'SQLite' ) {
-%> implementation "org.xerial:sqlite-jdbc:3.16.1"
+%> implementation "org.xerial:sqlite-jdbc:$sqliteVersion"
<%
}
%>
runtimeOnly "org.apache.polygene.core:org.apache.polygene.core.runtime:$polygeneVersion"
- runtimeOnly "org.restlet.jee:org.restlet.ext.servlet:2.3.4"
- runtimeOnly "org.apache.johnzon:johnzon-core:1.1.0"
- runtimeOnly "org.apache.johnzon:johnzon-mapper:1.1.0"
+ runtimeOnly "org.apache.johnzon:johnzon-core:$johnzonVersion"
+ runtimeOnly "org.apache.johnzon:johnzon-mapper:$johnzonVersion"
runtimeOnly "org.apache.geronimo.specs:geronimo-json_1.1_spec:1.0"
- implementation "ch.qos.logback:logback-classic:1.2.3"
- implementation "ch.qos.logback:logback-core:1.2.3"
+ runtimeOnly "ch.qos.logback:logback-classic:$logbackVersion"
+ runtimeOnly "ch.qos.logback:logback-core:$logbackVersion"
testImplementation "org.apache.polygene.tools:org.apache.polygene.tool.model-detail:$polygeneVersion"
testImplementation "org.apache.polygene.core:org.apache.polygene.core.testsupport:$polygeneVersion"
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl
index 357b607..6ec2b7f 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl
@@ -25,8 +25,35 @@ if( project.version == 'unspecified' )
rootProject.ext {
polygeneVersion = "<%= polygene.version %>"
+ logbackVersion = "1.2.3"
+ johnzonVersion = "1.1.0"
<% if( polygene.applicationtype === "Rest API" ) {
%> jettyVersion = "9.2.17.v20160517"
+ restletVersion = "2.3.4"
+<%
+}
+if( polygene.entitystore == 'DerbySQL' ) {
+%> derbyVersion "10.13.1.1"
+<%
+}
+if( polygene.entitystore == 'H2SQL' ) {
+%> h2Version = "1.4.194"
+<%
+}
+if( polygene.entitystore == 'MySQL' ) {
+%> mysqlVersion = "6.0.6"
+<%
+}
+if( polygene.entitystore == 'PostgreSQL' ) {
+%> postgresVersion = "42.0.0"
+<%
+}
+if( polygene.entitystore == 'LevelDB' ) {
+%> levelDbVersion = "1.8"
+<%
+}
+if( polygene.entitystore == 'SQLite' ) {
+%> sqliteVersion = "3.16.1"
<%
}
%>}