incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r943661 - in /incubator/bval/trunk: ./ bval-core/ bval-core/src/main/java/org/apache/bval/json/ bval-core/src/main/resources/ bval-core/src/test/java/org/apache/bval/json/ bval-optional/ bval-optional/src/ bval-optional/src/main/ bval-optio...
Date Wed, 12 May 2010 19:57:14 GMT
Author: dwoods
Date: Wed May 12 19:57:13 2010
New Revision: 943661

URL: http://svn.apache.org/viewvc?rev=943661&view=rev
Log:
BVAL-44 Move optional code out of bval-core to a bval-optional module.  Part 1 - JSON files
moved out.

Added:
    incubator/bval/trunk/bval-optional/
    incubator/bval/trunk/bval-optional/pom.xml   (with props)
    incubator/bval/trunk/bval-optional/src/
    incubator/bval/trunk/bval-optional/src/main/
    incubator/bval/trunk/bval-optional/src/main/appended-resources/
    incubator/bval/trunk/bval-optional/src/main/appended-resources/META-INF/
    incubator/bval/trunk/bval-optional/src/main/appended-resources/META-INF/NOTICE.vm   (with
props)
    incubator/bval/trunk/bval-optional/src/main/java/
    incubator/bval/trunk/bval-optional/src/main/java/org/
    incubator/bval/trunk/bval-optional/src/main/java/org/apache/
    incubator/bval/trunk/bval-optional/src/main/java/org/apache/bval/
    incubator/bval/trunk/bval-optional/src/main/java/org/apache/bval/optional/
    incubator/bval/trunk/bval-optional/src/main/java/org/apache/bval/optional/json/
      - copied from r943637, incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/json/
    incubator/bval/trunk/bval-optional/src/main/resources/
    incubator/bval/trunk/bval-optional/src/main/resources/org/
    incubator/bval/trunk/bval-optional/src/main/resources/org/apache/
    incubator/bval/trunk/bval-optional/src/main/resources/org/apache/bval/
    incubator/bval/trunk/bval-optional/src/main/resources/org/apache/bval/optional/
    incubator/bval/trunk/bval-optional/src/main/resources/org/apache/bval/optional/json/
    incubator/bval/trunk/bval-optional/src/main/resources/org/apache/bval/optional/json/bean-infos-json.ftl
    incubator/bval/trunk/bval-optional/src/test/
    incubator/bval/trunk/bval-optional/src/test/java/
    incubator/bval/trunk/bval-optional/src/test/java/org/
    incubator/bval/trunk/bval-optional/src/test/java/org/apache/
    incubator/bval/trunk/bval-optional/src/test/java/org/apache/bval/
    incubator/bval/trunk/bval-optional/src/test/java/org/apache/bval/optional/
    incubator/bval/trunk/bval-optional/src/test/java/org/apache/bval/optional/json/
      - copied from r943637, incubator/bval/trunk/bval-core/src/test/java/org/apache/bval/json/
Removed:
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/json/
    incubator/bval/trunk/bval-core/src/main/resources/
    incubator/bval/trunk/bval-core/src/test/java/org/apache/bval/json/
Modified:
    incubator/bval/trunk/bval-core/pom.xml
    incubator/bval/trunk/bval-optional/src/main/java/org/apache/bval/optional/json/JSONGenerator.java
    incubator/bval/trunk/bval-optional/src/test/java/org/apache/bval/optional/json/JSONGeneratorTest.java
    incubator/bval/trunk/pom.xml

Modified: incubator/bval/trunk/bval-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/pom.xml?rev=943661&r1=943660&r2=943661&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/pom.xml (original)
+++ incubator/bval/trunk/bval-core/pom.xml Wed May 12 19:57:13 2010
@@ -38,11 +38,6 @@
 
     <dependencies>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>commons-lang</groupId>
             <artifactId>commons-lang</artifactId>
         </dependency>
@@ -51,11 +46,6 @@
             <artifactId>commons-logging</artifactId>
         </dependency>
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>commons-beanutils</groupId>
             <artifactId>commons-beanutils</artifactId>
         </dependency>
@@ -68,9 +58,14 @@
             <artifactId>commons-collections</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.freemarker</groupId>
-            <artifactId>freemarker</artifactId>
-            <optional>true</optional>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <scope>test</scope>
         </dependency>
     </dependencies>
 
@@ -83,14 +78,6 @@
             </resource>
         </resources>
 
-        <extensions>
-            <extension>
-                <groupId>org.apache.maven.wagon</groupId>
-                <artifactId>wagon-webdav</artifactId>
-                <version>1.0-beta-2</version>
-            </extension>
-        </extensions>
-
         <plugins>
             <!--
                 get the svn revision number and project version
@@ -145,27 +132,22 @@ project.version=${project.version}
                 </configuration>
             </plugin>
 
-            <!-- create an OSGi bundle -->
+            <!--
+                 Create a tests.jar so we can reuse some of the base
+                 test classes in other modules.
+            -->
             <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <!-- OSGi Bundle Metadata -->
-                        <Bundle-DocURL>${project.url}</Bundle-DocURL>
-                        <Bundle-Activator></Bundle-Activator>
-                        <Private-Package />
-                        <Export-Package>org.apache.bval.*</Export-Package>
-                        <!-- No export version for now...
-                        <Export-Package>org.apache.bval.*;version=${project.version}</Export-Package>
-                        -->
-                        <Import-Package>freemarker.template.*;resolution:=optional,*</Import-Package>
-                        <!-- Eclipse metadata -->
-                        <Eclipse-Autostart>false</Eclipse-Autostart>
-                        <Bundle-ClassPath>.</Bundle-ClassPath>
-                    </instructions>
-                </configuration>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-tests</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
             </plugin>
 
         </plugins>

Added: incubator/bval/trunk/bval-optional/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-optional/pom.xml?rev=943661&view=auto
==============================================================================
--- incubator/bval/trunk/bval-optional/pom.xml (added)
+++ incubator/bval/trunk/bval-optional/pom.xml Wed May 12 19:57:13 2010
@@ -0,0 +1,94 @@
+<?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.
+-->
+<!--
+	Maven release plugin requires the project tag to be on a single line.
+-->
+<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">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.bval</groupId>
+        <artifactId>bval-parent</artifactId>
+        <version>0.1-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>bval-optional</artifactId>
+    <name>Apache Bean Validation :: bval-optional</name>
+    <packaging>bundle</packaging>
+
+    <description>Bean Validation Optional Components</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.bval</groupId>
+            <artifactId>bval-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.freemarker</groupId>
+            <artifactId>freemarker</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.bval</groupId>
+            <artifactId>bval-core</artifactId>
+            <version>${project.version}</version>
+            <!-- <classifier>test-base</classifier> -->
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <defaultGoal>install</defaultGoal>
+
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+
+        <plugins>
+            <!-- create an OSGi bundle
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-DocURL>${project.url}</Bundle-DocURL>
+                        <Bundle-Activator></Bundle-Activator>
+                        <Private-Package />
+                        <Export-Package>org.apache.bval.optional.*</Export-Package>
+                        <Eclipse-Autostart>false</Eclipse-Autostart>
+                        <Bundle-ClassPath>.</Bundle-ClassPath>
+                    </instructions>
+                </configuration>
+            </plugin>
+-->
+        </plugins>
+    </build>
+</project>
+

Propchange: incubator/bval/trunk/bval-optional/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/trunk/bval-optional/src/main/appended-resources/META-INF/NOTICE.vm
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-optional/src/main/appended-resources/META-INF/NOTICE.vm?rev=943661&view=auto
==============================================================================
--- incubator/bval/trunk/bval-optional/src/main/appended-resources/META-INF/NOTICE.vm (added)
+++ incubator/bval/trunk/bval-optional/src/main/appended-resources/META-INF/NOTICE.vm Wed
May 12 19:57:13 2010
@@ -0,0 +1,25 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##  http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+The following copyright notice(s) were affixed to portions of this code
+with which this file is now or was at one time distributed.
+
+This product includes software developed by agimatec GmbH.
+Copyright 2007-2010 Agimatec GmbH. All rights reserved.
+

Propchange: incubator/bval/trunk/bval-optional/src/main/appended-resources/META-INF/NOTICE.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/bval/trunk/bval-optional/src/main/java/org/apache/bval/optional/json/JSONGenerator.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-optional/src/main/java/org/apache/bval/optional/json/JSONGenerator.java?rev=943661&r1=943637&r2=943661&view=diff
==============================================================================
--- incubator/bval/trunk/bval-optional/src/main/java/org/apache/bval/optional/json/JSONGenerator.java
(original)
+++ incubator/bval/trunk/bval-optional/src/main/java/org/apache/bval/optional/json/JSONGenerator.java
Wed May 12 19:57:13 2010
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.bval.json;
+package org.apache.bval.optional.json;
 
 import java.io.IOException;
 import java.io.StringWriter;
@@ -34,8 +34,10 @@ import freemarker.template.TemplateExcep
 /**
  * Description: Generate a JSON String for a collection of {@link MetaBean}s.
  * This implementation uses a freemarker template to generate the output.<br/>
+ *
+ * This is an optional module which requires the freemarker dependency
+ * and template resourece file "bean-infos-json.ftl" with it.
  */
-// TODO RSt - move. this is an optional module: move freemarker dependency and template "bean-infos-json.ftl"
with it.
 public class JSONGenerator {
     private final Template template;
 

Added: incubator/bval/trunk/bval-optional/src/main/resources/org/apache/bval/optional/json/bean-infos-json.ftl
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-optional/src/main/resources/org/apache/bval/optional/json/bean-infos-json.ftl?rev=943661&view=auto
==============================================================================
--- incubator/bval/trunk/bval-optional/src/main/resources/org/apache/bval/optional/json/bean-infos-json.ftl
(added)
+++ incubator/bval/trunk/bval-optional/src/main/resources/org/apache/bval/optional/json/bean-infos-json.ftl
Wed May 12 19:57:13 2010
@@ -0,0 +1,64 @@
+bval.namespace("bval.metadata");
+
+(function(){
+<#assign var = 0>
+<#assign varrefs = {}>
+
+<#list metaBeans as metaBean>
+<#assign varrefs = varrefs + {metaBean.id : var}>
+var metaBean${var} = {
+ "id" : "${metaBean.id}",
+ <#if metaBean.beanClass??>"beanClass" : "${metaBean.beanClass.name}",</#if>
+ <#if metaBean.name??>"name" : "${metaBean.name}",</#if>
+ "features" :{<#rt/>
+   <#list metaBean.features?keys as featureKey>
+      <#assign value = metaBean.features[featureKey]>
+   "${featureKey}" : <#if
+          value?is_string>"${value}"<#elseif
+          value?is_boolean>${value?string}<#elseif
+          value?is_number>${value}<#elseif
+          value?is_date>${value?string.full}<#elseif
+          !(value??)>null<#elseif value?is_sequence>[<#list value as v>"${v}"<#if
v_has_next>,</#if></#list>]<#elseif
+          value?is_hash>{<#list value?keys as key>"${key}" : "${value[key]}"<#if
key_has_next>,</#if></#list>}<#else
+          >"?"</#if><#rt/><#if
+          featureKey_has_next>,</#if>
+   </#list>
+   <#lt/>},
+ "properties" :{
+   <#list metaBean.properties as property>
+     "${property.name}":{
+       "name" : "${property.name}",
+       <#if property.type??>"type" : "${property.type.name}",</#if>
+       "features" : {<#if property.type?? &&
+       property.type.enum>"enum" : {<#list property.type.enumConstants as enum>"${enum.name()}":
"${enum.name()}"<#if enum_has_next>, </#if></#list>}<#if property.features?size
&gt; 0>,</#if></#if><#list
+       property.features?keys as featureKey>
+       <#assign value = property.features[featureKey]>
+       "${featureKey}" : <#rt/><#if
+          value?is_string>"${value}"<#elseif
+          value?is_boolean>${value?string}<#elseif
+          value?is_number>${value}<#elseif
+          value?is_date>${value?string.full}<#elseif
+          !(value??)>null<#elseif value?is_sequence>[<#list value as v>"${v}"<#if
v_has_next>,</#if></#list>]<#elseif
+          value?is_hash_ex>{<#list value?keys as key>"${key}" : "${value[key]}"<#if
key_has_next>,</#if></#list>}<#else
+          >"?"</#if><#rt/><#if featureKey_has_next>,</#if>
+       </#list>
+       }
+     }<#if property_has_next>,</#if>
+   </#list>
+   }
+};
+<#assign var = var + 1>
+</#list>
+
+<#assign var = 0>
+<#list metaBeans as metaBean><#list
+    metaBean.properties as property><#if
+    property.metaBean?? && varrefs[property.metaBean.id]??>
+metaBean${var}.properties.${property.name}.metaBean = metaBean${varrefs[property.metaBean.id]};
+</#if></#list><#assign var = var + 1></#list><#assign var = 0>
+bval.metadata.metaBeans = {
+<#list metaBeans as metaBean>
+       "${metaBean.id}" : metaBean${var}<#if metaBean_has_next>,</#if>
+       <#assign var = var + 1>
+</#list>};
+})();
\ No newline at end of file

Modified: incubator/bval/trunk/bval-optional/src/test/java/org/apache/bval/optional/json/JSONGeneratorTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-optional/src/test/java/org/apache/bval/optional/json/JSONGeneratorTest.java?rev=943661&r1=943637&r2=943661&view=diff
==============================================================================
--- incubator/bval/trunk/bval-optional/src/test/java/org/apache/bval/optional/json/JSONGeneratorTest.java
(original)
+++ incubator/bval/trunk/bval-optional/src/test/java/org/apache/bval/optional/json/JSONGeneratorTest.java
Wed May 12 19:57:13 2010
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.bval.json;
+package org.apache.bval.optional.json;
 
 import junit.framework.TestCase;
 import org.apache.bval.MetaBeanManager;
@@ -31,12 +31,8 @@ import java.util.List;
 
 /**
  * Description: <br>
- * User: roman.stumm<br>
- * Date: 31.03.2010<br>
- * Time: 17:00:17<br>
- * viaboxx GmbH, 2010
+ * Author: roman.stumm<br>
  */
-// TODO RSt - move. this tests an optional module
 public class JSONGeneratorTest extends TestCase {
   private MetaBeanManager mbm;
 

Modified: incubator/bval/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/pom.xml?rev=943661&r1=943660&r2=943661&view=diff
==============================================================================
--- incubator/bval/trunk/pom.xml (original)
+++ incubator/bval/trunk/pom.xml Wed May 12 19:57:13 2010
@@ -508,6 +508,7 @@
     <modules>
         <module>bval-core</module>
         <module>bval-jsr303</module>
+        <module>bval-optional</module>
         <!-- <module>bval-tck</module> -->
     </modules>
 



Mime
View raw message