You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2009/02/19 17:43:41 UTC
svn commit: r745921 - in /camel/trunk/components/camel-web: pom.xml
src/main/java/org/apache/camel/web/util/CamelResourceConfig.java
src/main/resources/application-doc.xml
src/main/resources/application-grammars.xml
Author: jstrachan
Date: Thu Feb 19 16:43:41 2009
New Revision: 745921
URL: http://svn.apache.org/viewvc?rev=745921&view=rev
Log:
CAMEL-1355 include the javadoc comments in the auto-generated WADL and browsable API
Added:
camel/trunk/components/camel-web/src/main/resources/application-doc.xml (with props)
camel/trunk/components/camel-web/src/main/resources/application-grammars.xml (with props)
Modified:
camel/trunk/components/camel-web/pom.xml
camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelResourceConfig.java
Modified: camel/trunk/components/camel-web/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/pom.xml?rev=745921&r1=745920&r2=745921&view=diff
==============================================================================
--- camel/trunk/components/camel-web/pom.xml (original)
+++ camel/trunk/components/camel-web/pom.xml Thu Feb 19 16:43:41 2009
@@ -228,8 +228,8 @@
<goals>
<goal>javadoc</goal>
</goals>
- <!--<phase>compile</phase>-->
- <phase>package</phase>
+ <phase>compile</phase>
+ <!--<phase>package</phase>-->
</execution>
</executions>
@@ -238,7 +238,7 @@
<encoding>UTF-8</encoding>
<verbose>false</verbose>
<show>public</show>
- <subpackages>com.sun.jersey.samples.generatewadl.resources</subpackages>
+ <subpackages>org.apache.camel.web.resources</subpackages>
<doclet>com.sun.jersey.wadl.resourcedoc.ResourceDoclet</doclet>
<docletArtifacts>
@@ -310,6 +310,72 @@
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>com.sun.jersey.contribs</groupId>
+ <artifactId>maven-wadl-plugin</artifactId>
+ <version>${jersey-version}</version>
+ <executions>
+ <execution>
+ <id>generate</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <phase>compile</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <wadlFile>${project.build.outputDirectory}/application.wadl</wadlFile>
+ <formatWadlFile>true</formatWadlFile>
+ <baseUri>http://www.example.com/api</baseUri>
+ <packagesResourceConfig>
+ <param>org.apache.camel.web.resources</param>
+ </packagesResourceConfig>
+ <wadlGenerators>
+ <wadlGeneratorDescription>
+ <className>com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc</className>
+ <properties>
+ <property>
+ <name>applicationDocsFile</name>
+ <value>${basedir}/src/main/resources/application-doc.xml</value>
+ </property>
+ </properties>
+ </wadlGeneratorDescription>
+ <wadlGeneratorDescription>
+ <className>com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport</className>
+ <properties>
+ <property>
+ <name>grammarsFile</name>
+ <value>${basedir}/src/main/resources/application-grammars.xml</value>
+ </property>
+ </properties>
+ </wadlGeneratorDescription>
+ <wadlGeneratorDescription>
+ <className>com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport</className>
+ <properties>
+ <property>
+ <name>resourceDocFile</name>
+ <value>${project.build.outputDirectory}/resourcedoc.xml</value>
+ </property>
+ </properties>
+ </wadlGeneratorDescription>
+ <!--
+ <wadlGeneratorDescription>
+ <className>com.sun.jersey.samples.generatewadl.util.ExampleWadlGenerator</className>
+ <properties>
+ <property>
+ <name>resourceDocFile</name>
+ <value>${project.build.outputDirectory}/resourcedoc.xml</value>
+ </property>
+ </properties>
+ </wadlGeneratorDescription>
+ -->
+ </wadlGenerators>
+ </configuration>
+
+ </plugin>
+
+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
Modified: camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelResourceConfig.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelResourceConfig.java?rev=745921&r1=745920&r2=745921&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelResourceConfig.java (original)
+++ camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelResourceConfig.java Thu Feb 19 16:43:41 2009
@@ -17,19 +17,42 @@
package org.apache.camel.web.util;
import com.sun.jersey.api.core.PackagesResourceConfig;
+import com.sun.jersey.api.core.ResourceConfig;
+import com.sun.jersey.api.wadl.config.WadlGeneratorConfig;
+import com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc;
+import com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport;
+import com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport;
+import org.apache.camel.web.resources.CamelContextResource;
+import org.apache.camel.web.resources.Constants;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
-import org.apache.camel.web.resources.Constants;
-
/**
* @version $Revision$
*/
public class CamelResourceConfig extends PackagesResourceConfig {
public CamelResourceConfig() {
- super("org.apache.camel.web");
+ super(createProperties());
+ }
+
+ protected static Map<String, Object> createProperties() {
+ Map<String, Object> properties = new HashMap<String, Object>();
+
+ properties.put(PackagesResourceConfig.PROPERTY_PACKAGES, CamelContextResource.class.getPackage().getName());
+
+ WadlGeneratorConfig config = WadlGeneratorConfig
+ .generator(WadlGeneratorApplicationDoc.class)
+ .prop("applicationDocsFile", "classpath:/application-doc.xml")
+ .generator(WadlGeneratorGrammarsSupport.class)
+ .prop("grammarsFile", "classpath:/application-grammars.xml")
+ .generator(WadlGeneratorResourceDocSupport.class)
+ .prop("resourceDocFile", "classpath:/resourcedoc.xml")
+ .build();
+
+ properties.put(ResourceConfig.PROPERTY_WADL_GENERATOR_CONFIG, config);
+ return properties;
}
public Map<String, MediaType> getMediaTypeMappings() {
Added: camel/trunk/components/camel-web/src/main/resources/application-doc.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/resources/application-doc.xml?rev=745921&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/resources/application-doc.xml (added)
+++ camel/trunk/components/camel-web/src/main/resources/application-doc.xml Thu Feb 19 16:43:41 2009
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<applicationDocs targetNamespace="http://research.sun.com/wadl/2006/10">
+
+ <doc xml:lang="en" title="Apache Camel Web Console and API">
+ <p>
+ For more on the REST API please see<a href="http://camel.apache.org/web-console.html">the Web Console documentation</a>.
+ </p>
+ </doc>
+
+</applicationDocs>
\ No newline at end of file
Propchange: camel/trunk/components/camel-web/src/main/resources/application-doc.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-web/src/main/resources/application-grammars.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/resources/application-grammars.xml?rev=745921&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/resources/application-grammars.xml (added)
+++ camel/trunk/components/camel-web/src/main/resources/application-grammars.xml Thu Feb 19 16:43:41 2009
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<grammars xmlns="http://research.sun.com/wadl/2006/10"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xi="http://www.w3.org/1999/XML/xinclude">
+ <include href="camel-web.xsd" />
+</grammars>
\ No newline at end of file
Propchange: camel/trunk/components/camel-web/src/main/resources/application-grammars.xml
------------------------------------------------------------------------------
svn:eol-style = native