velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbris...@apache.org
Subject svn commit: r1857743 - in /velocity/tools/branches/model: ./ velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ velocity-tools-model/ velocity-tools-model/src/ velocity-tools-model/src/main/ velocity-tools-model/src/main/java/ veloc...
Date Thu, 18 Apr 2019 13:05:53 GMT
Author: cbrisson
Date: Thu Apr 18 13:05:53 2019
New Revision: 1857743

URL: http://svn.apache.org/viewvc?rev=1857743&view=rev
Log:
[tools/model] Create velocity-tools-model child module

Added:
    velocity/tools/branches/model/velocity-tools-model/
    velocity/tools/branches/model/velocity-tools-model/dependency-reduced-pom.xml
    velocity/tools/branches/model/velocity-tools-model/pom.xml
    velocity/tools/branches/model/velocity-tools-model/src/
    velocity/tools/branches/model/velocity-tools-model/src/main/
    velocity/tools/branches/model/velocity-tools-model/src/main/java/
    velocity/tools/branches/model/velocity-tools-model/src/main/java/org/
    velocity/tools/branches/model/velocity-tools-model/src/main/java/org/apache/
    velocity/tools/branches/model/velocity-tools-model/src/main/java/org/apache/velocity/
    velocity/tools/branches/model/velocity-tools-model/src/main/java/org/apache/velocity/tools/
    velocity/tools/branches/model/velocity-tools-model/src/main/java/org/apache/velocity/tools/model/
    velocity/tools/branches/model/velocity-tools-model/src/main/resources/
    velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/
    velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/
    velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/
    velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/
    velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/model/
    velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/model/tools.xml
    velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/model/velocity.properties
    velocity/tools/branches/model/velocity-tools-model/src/test/
    velocity/tools/branches/model/velocity-tools-model/src/test/java/
    velocity/tools/branches/model/velocity-tools-model/src/test/java/org/
    velocity/tools/branches/model/velocity-tools-model/src/test/java/org/apache/
    velocity/tools/branches/model/velocity-tools-model/src/test/java/org/apache/velocity/
    velocity/tools/branches/model/velocity-tools-model/src/test/java/org/apache/velocity/tools/
    velocity/tools/branches/model/velocity-tools-model/src/test/java/org/apache/velocity/tools/model/
Modified:
    velocity/tools/branches/model/pom.xml
    velocity/tools/branches/model/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java
    velocity/tools/branches/model/velocity-tools-view/pom.xml
    velocity/tools/branches/model/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java

Modified: velocity/tools/branches/model/pom.xml
URL: http://svn.apache.org/viewvc/velocity/tools/branches/model/pom.xml?rev=1857743&r1=1857742&r2=1857743&view=diff
==============================================================================
--- velocity/tools/branches/model/pom.xml (original)
+++ velocity/tools/branches/model/pom.xml Thu Apr 18 13:05:53 2019
@@ -52,6 +52,7 @@
   <modules>
     <module>velocity-tools-generic</module>
     <module>velocity-tools-view</module>
+    <module>velocity-tools-model</module>
     <module>velocity-tools-view-jsp</module>
     <module>velocity-tools-examples</module>
   </modules>
@@ -194,6 +195,10 @@
               <name>org.slf4j.simpleLogger.logFile</name>
               <value>${project.build.directory}/velocity-tools.log</value>
             </property>
+            <property>
+              <name>test.resources.dir</name>
+              <value>${project.build.testOutputDirectory}</value>
+            </property>
           </systemProperties>
         </configuration>
       </plugin>

Modified: velocity/tools/branches/model/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/model/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java?rev=1857743&r1=1857742&r2=1857743&view=diff
==============================================================================
--- velocity/tools/branches/model/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java
(original)
+++ velocity/tools/branches/model/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java
Thu Apr 18 13:05:53 2019
@@ -85,6 +85,9 @@ public class ConfigurationUtils
         // view tools may not be available
         config.read(VIEW_DEFAULTS_PATH, false);
 
+        // model tools may not be available
+        config.read(MODEL_DEFAULTS_PATH, false);
+
         // defaults should *always* be clean!
         clean(config);
         return config;
@@ -108,7 +111,7 @@ public class ConfigurationUtils
 
     /**
      * <p>Returns a {@link FactoryConfiguration} including all default
-     * "VelocityView" tools available as well as the default "GenericTools".</p>
+     * "velocity-tools-view" tools available as well as the default "GenericTools".</p>
      * @return all default tools {@link FactoryConfiguration}
      * @throws ConfigurationException if a tools.xml is not found at the {@link #VIEW_DEFAULTS_PATH}.
      */
@@ -125,6 +128,26 @@ public class ConfigurationUtils
     }
 
     /**
+     * <p>Returns a {@link FactoryConfiguration} including all default
+     * "velocity-tools-view" and "velocity-tools-model" tools available as well as the default
"GenericTools".</p>
+     * @return all default tools {@link FactoryConfiguration}
+     * @throws ConfigurationException if a tools.xml is not found at the {@link #VIEW_DEFAULTS_PATH}.
+     */
+    public static FactoryConfiguration getModelView()
+    {
+        FileFactoryConfiguration config =
+            new XmlFactoryConfiguration("ConfigurationUtils.getVelocityView()");
+        config.read(GENERIC_DEFAULTS_PATH);
+        config.read(VIEW_DEFAULTS_PATH);
+        config.read(MODEL_DEFAULTS_PATH);
+
+        // defaults should *always* be clean!
+        clean(config);
+        return config;
+    }
+
+
+    /**
      * Returns a {@link FactoryConfiguration} loaded from the path specified
      * in the "org.apache.velocity.tools" system property (if any).
      * If no such property has been set {@code null} will be returned.

Added: velocity/tools/branches/model/velocity-tools-model/dependency-reduced-pom.xml
URL: http://svn.apache.org/viewvc/velocity/tools/branches/model/velocity-tools-model/dependency-reduced-pom.xml?rev=1857743&view=auto
==============================================================================
--- velocity/tools/branches/model/velocity-tools-model/dependency-reduced-pom.xml (added)
+++ velocity/tools/branches/model/velocity-tools-model/dependency-reduced-pom.xml Thu Apr
18 13:05:53 2019
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>velocity-tools-parent</artifactId>
+    <groupId>org.apache.velocity.tools</groupId>
+    <version>3.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>velocity-tools-model</artifactId>
+  <name>Apache Velocity Tools - Model Tool</name>
+  <description>Tool to define a model and expose it to the view layer.</description>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>3.2.1</version>
+        <executions>
+          <execution>
+            <id>shade</id>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <artifactSet>
+                <includes>
+                  <include>commons-codec:commons-codec</include>
+                </includes>
+                <excludes>
+                  <exclude>org.slf4j:slf4j-api</exclude>
+                </excludes>
+              </artifactSet>
+              <relocations>
+                <relocation>
+                  <pattern>org.apache.commons.codec</pattern>
+                  <shadedPattern>org.apache.velocity.tools.model.shaded.commons.codec</shadedPattern>
+                </relocation>
+              </relocations>
+              <minimizeJar>true</minimizeJar>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemProperties>
+            <property>
+              <name>test.output.dir</name>
+              <value>${project.build.testOutputDirectory}</value>
+            </property>
+            <property>
+              <name>org.slf4j.simpleLogger.defaultLogLevel</name>
+              <value>trace</value>
+            </property>
+          </systemProperties>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.velocity.tools</groupId>
+      <artifactId>velocity-tools-generic</artifactId>
+      <version>3.1-SNAPSHOT</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.velocity.tools</groupId>
+      <artifactId>velocity-tools-view</artifactId>
+      <version>3.1-SNAPSHOT</version>
+      <scope>compile</scope>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>javax.servlet-api</artifactId>
+      <version>3.1.0</version>
+      <scope>provided</scope>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.atteo</groupId>
+      <artifactId>evo-inflector</artifactId>
+      <version>1.2.2</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <artifactId>hamcrest-core</artifactId>
+          <groupId>org.hamcrest</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.25</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-dbcp2</artifactId>
+      <version>2.6.0</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <artifactId>commons-pool2</artifactId>
+          <groupId>org.apache.commons</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <version>2.4.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.6</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <version>3.6</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <artifactId>objenesis</artifactId>
+          <groupId>org.objenesis</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
+  <properties>
+    <byte-buddy.version>1.9.12</byte-buddy.version>
+  </properties>
+</project>

Added: velocity/tools/branches/model/velocity-tools-model/pom.xml
URL: http://svn.apache.org/viewvc/velocity/tools/branches/model/velocity-tools-model/pom.xml?rev=1857743&view=auto
==============================================================================
--- velocity/tools/branches/model/velocity-tools-model/pom.xml (added)
+++ velocity/tools/branches/model/velocity-tools-model/pom.xml Thu Apr 18 13:05:53 2019
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>velocity-tools-parent</artifactId>
+        <groupId>org.apache.velocity.tools</groupId>
+        <version>3.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>velocity-tools-model</artifactId>
+
+    <name>Apache Velocity Tools - Model Tool</name>
+    <description>Tool to define a model and expose it to the view layer.</description>
+
+    <properties>
+        <byte-buddy.version>1.9.12</byte-buddy.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <systemProperties>
+                        <property>
+                            <name>test.output.dir</name>
+                            <value>${project.build.testOutputDirectory}</value>
+                        </property>
+                        <property>
+                            <name>org.slf4j.simpleLogger.defaultLogLevel</name>
+                            <value>info</value>
+                        </property>
+                    </systemProperties>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.velocity.tools</groupId>
+            <artifactId>velocity-tools-generic</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

Added: velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/model/tools.xml
URL: http://svn.apache.org/viewvc/velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/model/tools.xml?rev=1857743&view=auto
==============================================================================
--- velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/model/tools.xml
(added)
+++ velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/model/tools.xml
Thu Apr 18 13:05:53 2019
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<tools>
+    <data type="boolean" key="MODEL_TOOL_AVAILABLE" value="true"/>
+    <toolbox scope="application">
+        <tool class="org.apache.velocity.tools.model.ModelTool"/>
+    </toolbox>
+</tools>

Added: velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/model/velocity.properties
URL: http://svn.apache.org/viewvc/velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/model/velocity.properties?rev=1857743&view=auto
==============================================================================
--- velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/model/velocity.properties
(added)
+++ velocity/tools/branches/model/velocity-tools-model/src/main/resources/org/apache/velocity/tools/model/velocity.properties
Thu Apr 18 13:05:53 2019
@@ -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.
+
+# use model uberspector
+#TODO runtime.introspector.uberspect = org.apache.velocity.tools.model.ModelUberspector,org.apache.velocity.util.introspection.UberspectImpl,org.apache.velocity.tools.view.WebappUberspector
+runtime.introspector.uberspect = org.apache.velocity.tools.model.ModelUberspector,org.apache.velocity.util.introspection.UberspectImpl
+
+# default values for model tool
+model.write = java
+model.reverse = none
+model.identifiers.inflector = org.atteo.evo.inflector.English
+# model.identifiers.mapping.* = lowercase
+# model.identifiers.mapping.*.* = lowercase
+model.filters.cryptograph = org.apache.velocity.tools.model.util.AESCryptograph
+
+# exemple uses of filters:
+# model.filters.write.java.util.calendar = calendar_to_date
+# model.filters.read.java.sql.Date = date_to_calendar
+# model.filters.read.*.*_id = obfuscate
+# model.filters.write.*.*_id = deobfuscate

Modified: velocity/tools/branches/model/velocity-tools-view/pom.xml
URL: http://svn.apache.org/viewvc/velocity/tools/branches/model/velocity-tools-view/pom.xml?rev=1857743&r1=1857742&r2=1857743&view=diff
==============================================================================
--- velocity/tools/branches/model/velocity-tools-view/pom.xml (original)
+++ velocity/tools/branches/model/velocity-tools-view/pom.xml Thu Apr 18 13:05:53 2019
@@ -88,6 +88,10 @@
               <name>test.output.dir</name>
               <value>${project.build.testOutputDirectory}</value>
             </property>
+            <property>
+              <name>org.slf4j.simpleLogger.defaultLogLevel</name>
+              <value>info</value>
+            </property>
             </systemProperties>
         </configuration>
       </plugin>

Modified: velocity/tools/branches/model/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/model/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java?rev=1857743&r1=1857742&r2=1857743&view=diff
==============================================================================
--- velocity/tools/branches/model/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java
(original)
+++ velocity/tools/branches/model/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java
Thu Apr 18 13:05:53 2019
@@ -126,6 +126,12 @@ public class VelocityView extends ViewTo
         "/org/apache/velocity/tools/view/velocity.properties";
 
     /**
+     * Optional Model Runtime properties.
+     */
+    public static final String MODEL_PROPERTIES_PATH =
+        "/org/apache/velocity/tools/model/velocity.properties";
+
+    /**
      * This is the string that is looked for when getInitParameter is
      * called ("org.apache.velocity.properties").
      */



Mime
View raw message