Author: bdudney
Date: Thu Aug 24 15:32:35 2006
New Revision: 434548
URL: http://svn.apache.org/viewvc?rev=434548&view=rev
Log:
added the confluence-maven-plugin and made a few changes to the build tools code
Added:
incubator/cayenne/main/trunk/other/build-tools/pom.xml
incubator/cayenne/main/trunk/other/confluence-maven-plugin/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/pom.xml
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/org/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/org/apache/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/org/apache/cayenne/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/org/apache/cayenne/other/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/org/apache/cayenne/other/plugin/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/org/apache/cayenne/other/plugin/confluence/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/org/apache/cayenne/other/plugin/confluence/ConfluenceExportMojo.java
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/org/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/org/apache/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/org/apache/cayenne/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/org/apache/cayenne/other/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/org/apache/cayenne/other/plugin/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/org/apache/cayenne/other/plugin/confluence/
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/org/apache/cayenne/other/plugin/confluence/ConfluenceExportMojoTest.java
Modified:
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocGenerator.java
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocPage.java
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocPageRenderer.java
incubator/cayenne/main/trunk/other/cayenne-regression-profiler/.settings/org.eclipse.jdt.core.prefs
incubator/cayenne/main/trunk/other/pom.xml
Added: incubator/cayenne/main/trunk/other/build-tools/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/other/build-tools/pom.xml?rev=434548&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/other/build-tools/pom.xml (added)
+++ incubator/cayenne/main/trunk/other/build-tools/pom.xml Thu Aug 24 15:32:35
2006
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <parent>
+ <artifactId>cayenne-other-parent</artifactId>
+ <groupId>org.apache.cayenne.other</groupId>
+ <version>3.0-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>cayenne-build-tools</artifactId>
+ <name>Cayenne Build Tools</name>
+ <description>Cayenne Build Tools</description>
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <url>
+
https://maven-repository.dev.java.net/nonav/repository
+ </url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.atlassian.confluence</groupId>
+ <artifactId>confluence-soap</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-ant</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ <dependency>
+ <groupId>velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cayenne.core</groupId>
+ <artifactId>cayenne-jdk1.4</artifactId>
+ <version>3.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml</groupId>
+ <artifactId>jaxrpc</artifactId>
+ <version>1.1</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundle-source-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundle-javadoc-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Modified:
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocGenerator.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocGenerator.java?rev=434548&r1=434547&r2=434548&view=diff
==============================================================================
---
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocGenerator.java
(original)
+++
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocGenerator.java
Thu Aug 24 15:32:35 2006
@@ -98,6 +98,10 @@
login();
+ // only works for adminstrators
+ //String url = service.exportSite(token, true);
+
+ //URL foo = new URL(url);
createPath(docBase);
// Build a page hierarchy first..
@@ -116,7 +120,6 @@
for (int i = 0; i < children.length; i++) {
DocPage child = getPage(parent, children[i].getTitle());
-
parent.addChild(child);
iterateChildren(child);
Modified:
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocPage.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocPage.java?rev=434548&r1=434547&r2=434548&view=diff
==============================================================================
---
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocPage.java
(original)
+++
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocPage.java
Thu Aug 24 15:32:35 2006
@@ -55,7 +55,8 @@
return (DocPage) titleMap.get(title);
}
- public DocPage(DocPage parentRef, String title, long id, String
rawContent) {
+ @SuppressWarnings("unchecked")
+ public DocPage(DocPage parentRef, String title, long id, String
rawContent) {
this.parentRef = parentRef;
this.title = title;
this.id = id;
@@ -82,7 +83,8 @@
children = new ArrayList();
}
- public void addChild(DocPage child) {
+ @SuppressWarnings("unchecked")
+ public void addChild(DocPage child) {
child.depth = depth + 1;
children.add(child);
}
Modified:
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocPageRenderer.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocPageRenderer.java?rev=434548&r1=434547&r2=434548&view=diff
==============================================================================
---
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocPageRenderer.java
(original)
+++
incubator/cayenne/main/trunk/other/build-tools/src/main/java/org/apache/cayenne/tools/ant/docgen/DocPageRenderer.java
Thu Aug 24 15:32:35 2006
@@ -27,218 +27,221 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import junit.framework.TestCase;
-
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.gen.ClassGeneratorResourceLoader;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.log.NullLogSystem;
-import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.gen.ClassGeneratorResourceLoader;
import
org.objectstyle.confluence.rpc.soap_axis.confluenceservice_v1.ConfluenceSoapService;
/**
- * Extracts embedded links from Confluence documentation and converts them to
local fs
- * references
+ * Extracts embedded links from Confluence documentation and converts them to
+ * local fs references
*
* @author Cris Daniluk
*/
-public class DocPageRenderer extends TestCase {
+public class DocPageRenderer {
- private static final String URL_PREFIX = "/confluence";
+ private static final String URL_PREFIX = "/confluence";
- /**
- * Only attachments within the page are supported right now. This could
easily be
- * adjusted to find attachments in external documents if necessary.
- */
- private static final Pattern attachmentPattern =
Pattern.compile("(href|src)=\""
- + URL_PREFIX
- + "/download/attachments/(.*?)/(.*?)\"");
-
- /**
- * When browsing the local filesystem, browsers like %20 (hex encoded)
instead of +
- * (legacy HTTP 0.9) for spaces.
- */
- private static final Pattern spaceEncoderPattern = Pattern
- .compile("href=\"(?!http://).*?\\+.*?\"");
-
- /**
- * Not all images are supported - only the ones referenced by current docs.
- */
- private static final Pattern confluenceImagePattern =
Pattern.compile("src=\""
- + URL_PREFIX
- + "/images/icons/(.*?)\"");
-
- /**
- * Take any confluence links to non-doc content and add the url
- */
- private Pattern confluenceLinkPattern = Pattern.compile("href=\"("
- + URL_PREFIX
- + "/display/.*?)\"");
-
- private Pattern embeddedLinkPattern;
-
- private ConfluenceSoapService service;
- private String token;
- private String spaceKey;
- private String baseUrl;
-
- private VelocityContext velCtxt;
- private Template pageTemplate;
-
- public DocPageRenderer(ConfluenceSoapService service, String baseUrl,
String token,
- String spaceKey, String template) throws Exception {
-
- // Note that these regexps have a fairly narrow capture - since the
HTML is
- // machine-generated,
- // we're kind of assuming it is well-formed
- embeddedLinkPattern = Pattern.compile("href=\""
- + URL_PREFIX
- + "/display/"
- + spaceKey
- + "/(.*?)\"");
-
- this.service = service;
- this.baseUrl = baseUrl;
- this.token = token;
- this.spaceKey = spaceKey;
-
- velCtxt = new VelocityContext();
-
- initializeClassTemplate(template);
- }
-
- private void initializeClassTemplate(String template) throws Exception {
- VelocityEngine velocityEngine = new VelocityEngine();
- try {
-
- // use ClasspathResourceLoader for velocity templates lookup
- // if Cayenne URL is not null, load resource from this URL
- Properties props = new Properties();
-
- // null logger that will prevent velocity.log from being generated
- props.put(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
NullLogSystem.class
- .getName());
-
- props.put("resource.loader", "cayenne");
-
- props.put("cayenne.resource.loader.class",
ClassGeneratorResourceLoader.class
- .getName());
-
- velocityEngine.init(props);
- }
- catch (Exception ex) {
- throw new CayenneRuntimeException("Can't initialize Velocity", ex);
- }
-
- pageTemplate = velocityEngine.getTemplate(template);
- }
-
- public void render(DocPage page, Writer out) throws Exception {
-
- // Add the TOC, unless this is the top-level page
- StringBuffer toc = new StringBuffer();
- if (page.getParentRef() != null) {
- toc.append("<div id=\"cayenne_toc\">\n");
-
- DocPage root = page.getRoot();
-
- iterateChildren(toc, page, root);
- toc.append("</div>\n");
- }
-
- // Figure out the level of nesting for relative links
- String basePath = "";
- for (int i = 1; i <= page.getDepth(); i++) {
- basePath += "../";
- }
-
- String renderedContent = service.renderContent(
- token,
- spaceKey,
- page.getId(),
- page.getRawContent(),
- new HashMap(Collections.singletonMap("style", "clean")));
-
- // Replace cross-doc links
- Matcher linkMatcher = embeddedLinkPattern.matcher(renderedContent);
- StringBuffer replacementBuffer = new StringBuffer();
- while (linkMatcher.find()) {
- DocPage destPage =
DocPage.getPageByTitle(linkMatcher.group(1).replace(
- '+',
- ' '));
-
- // If we don't understand the link, just leave it alone to be safe
- if (destPage == null) {
- continue;
- }
- linkMatcher.appendReplacement(replacementBuffer, "href=\""
- + basePath
- + destPage.getLinkPath()
- + "/index.html\"");
- }
- linkMatcher.appendTail(replacementBuffer);
-
- renderedContent = replacementBuffer.toString();
-
- // renderedContent =
- //
embeddedLinkPattern.matcher(renderedContent).replaceAll("href=\"$1/index.html\"");
-
- // Replace attachment links
- renderedContent =
attachmentPattern.matcher(renderedContent).replaceAll(
- "$1=\"$3\"");
-
- // Convert confluence images to relative links
- renderedContent =
confluenceImagePattern.matcher(renderedContent).replaceAll(
- "src=\"" + basePath + "images/$1\"");
-
- // Replace wiki links
- renderedContent =
confluenceLinkPattern.matcher(renderedContent).replaceAll(
- "href=\"" + baseUrl + "$1\"");
-
- // Convert local links with + to %20 to make browsers happy (wtf?)
- Matcher matcher = spaceEncoderPattern.matcher(renderedContent);
-
- replacementBuffer = new StringBuffer();
- while (matcher.find()) {
- matcher.appendReplacement(replacementBuffer,
matcher.group(0).replace(
- "+",
- "%20"));
- }
- matcher.appendTail(replacementBuffer);
-
- renderedContent = replacementBuffer.toString();
-
- velCtxt.put("page", page);
- velCtxt.put("basePath", basePath);
- velCtxt.put("pageContent", toc.toString() + renderedContent);
-
- pageTemplate.merge(velCtxt, out);
-
- }
-
- private void iterateChildren(StringBuffer toc, DocPage currentPage,
DocPage basePage) {
- toc.append("<ul>\n");
- for (Iterator baseIter = basePage.getChildren().iterator();
baseIter.hasNext();) {
-
- DocPage child = (DocPage) baseIter.next();
-
- toc.append("<li>").append("<a href=\"");
- for (int i = 1; i <= currentPage.getDepth(); i++) {
- toc.append("../");
- }
- toc.append(child.getLinkPath()).append("/index.html\">");
- toc.append(child.getTitle()).append("</a>");
- if (child.hasDescendent(currentPage)) {
- // render children
- iterateChildren(toc, currentPage, child);
- }
+ /**
+ * Only attachments within the page are supported right now. This could
+ * easily be adjusted to find attachments in external documents if
+ * necessary.
+ */
+ private static final Pattern attachmentPattern = Pattern
+ .compile("(href|src)=\"" + URL_PREFIX
+ +
"/download/attachments/(.*?)/(.*?)\"");
+
+ /**
+ * When browsing the local filesystem, browsers like %20 (hex encoded)
+ * instead of + (legacy HTTP 0.9) for spaces.
+ */
+ private static final Pattern spaceEncoderPattern = Pattern
+ .compile("href=\"(?!http://).*?\\+.*?\"");
+
+ /**
+ * Not all images are supported - only the ones referenced by current
docs.
+ */
+ private static final Pattern confluenceImagePattern = Pattern
+ .compile("src=\"" + URL_PREFIX +
"/images/icons/(.*?)\"");
+
+ /**
+ * Take any confluence links to non-doc content and add the url
+ */
+ private Pattern confluenceLinkPattern = Pattern.compile("href=\"("
+ + URL_PREFIX + "/display/.*?)\"");
+
+ private Pattern embeddedLinkPattern;
+
+ private ConfluenceSoapService service;
+
+ private String token;
+
+ private String spaceKey;
+
+ private String baseUrl;
+
+ private VelocityContext velCtxt;
+
+ private Template pageTemplate;
+
+ public DocPageRenderer(ConfluenceSoapService service, String baseUrl,
+ String token, String spaceKey, String template) throws
Exception {
+
+ // Note that these regexps have a fairly narrow capture - since
the HTML
+ // is
+ // machine-generated,
+ // we're kind of assuming it is well-formed
+ embeddedLinkPattern = Pattern.compile("href=\"" + URL_PREFIX
+ + "/display/" + spaceKey + "/(.*?)\"");
+
+ this.service = service;
+ this.baseUrl = baseUrl;
+ this.token = token;
+ this.spaceKey = spaceKey;
+
+ velCtxt = new VelocityContext();
+
+ initializeClassTemplate(template);
+ }
+
+ private void initializeClassTemplate(String template) throws Exception {
+ VelocityEngine velocityEngine = new VelocityEngine();
+ try {
+
+ // use ClasspathResourceLoader for velocity templates
lookup
+ // if Cayenne URL is not null, load resource from this
URL
+ Properties props = new Properties();
+
+ // null logger that will prevent velocity.log from
being generated
+ props.put(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
+ NullLogSystem.class.getName());
+
+ props.put("resource.loader", "cayenne");
+
+ props.put("cayenne.resource.loader.class",
+
ClassGeneratorResourceLoader.class.getName());
+
+ velocityEngine.init(props);
+ } catch (Exception ex) {
+ throw new CayenneRuntimeException("Can't initialize
Velocity", ex);
+ }
+
+ pageTemplate = velocityEngine.getTemplate(template);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void render(DocPage page, Writer out) throws Exception {
+
+ // Add the TOC, unless this is the top-level page
+ StringBuffer toc = new StringBuffer();
+ if (page.getParentRef() != null) {
+ toc.append("<div id=\"cayenne_toc\">\n");
+
+ DocPage root = page.getRoot();
+
+ iterateChildren(toc, page, root);
+ toc.append("</div>\n");
+ }
+
+ // Figure out the level of nesting for relative links
+ String basePath = "";
+ for (int i = 1; i <= page.getDepth(); i++) {
+ basePath += "../";
+ }
+
+ String renderedContent = null;
+ try {
+ renderedContent = service.renderContent(token,
spaceKey, page
+ .getId(), page.getRawContent(), new
HashMap(Collections
+ .singletonMap("style", "clean")));
+ } catch (Throwable t) {
+ // could have hit a DOS prevention bit so
+ // sleep for 250ms and try again
+ Thread.sleep(250);
+ renderedContent = service.renderContent(token,
spaceKey, page
+ .getId(), page.getRawContent(), new
HashMap(Collections
+ .singletonMap("style", "clean")));
+ }
+ // Replace cross-doc links
+ Matcher linkMatcher =
embeddedLinkPattern.matcher(renderedContent);
+ StringBuffer replacementBuffer = new StringBuffer();
+ while (linkMatcher.find()) {
+ DocPage destPage =
DocPage.getPageByTitle(linkMatcher.group(1)
+ .replace('+', ' '));
+
+ // If we don't understand the link, just leave it alone
to be safe
+ if (destPage == null) {
+ continue;
+ }
+ linkMatcher.appendReplacement(replacementBuffer,
"href=\""
+ + basePath + destPage.getLinkPath() +
"/index.html\"");
+ }
+ linkMatcher.appendTail(replacementBuffer);
+
+ renderedContent = replacementBuffer.toString();
+
+ // renderedContent =
+ //
embeddedLinkPattern.matcher(renderedContent).replaceAll("href=\"$1/index.html\"");
+
+ // Replace attachment links
+ renderedContent = attachmentPattern.matcher(renderedContent)
+ .replaceAll("$1=\"$3\"");
+
+ // Convert confluence images to relative links
+ renderedContent =
confluenceImagePattern.matcher(renderedContent)
+ .replaceAll("src=\"" + basePath +
"images/$1\"");
+
+ // Replace wiki links
+ renderedContent = confluenceLinkPattern.matcher(renderedContent)
+ .replaceAll("href=\"" + baseUrl + "$1\"");
+
+ // Convert local links with + to %20 to make browsers happy
(wtf?)
+ Matcher matcher = spaceEncoderPattern.matcher(renderedContent);
+
+ replacementBuffer = new StringBuffer();
+ while (matcher.find()) {
+ matcher.appendReplacement(replacementBuffer,
matcher.group(0)
+ .replace("+", "%20"));
+ }
+ matcher.appendTail(replacementBuffer);
+
+ renderedContent = replacementBuffer.toString();
+
+ velCtxt.put("page", page);
+ velCtxt.put("basePath", basePath);
+ velCtxt.put("pageContent", toc.toString() + renderedContent);
+
+ pageTemplate.merge(velCtxt, out);
+
+ }
+
+ private void iterateChildren(StringBuffer toc, DocPage currentPage,
+ DocPage basePage) {
+ toc.append("<ul>\n");
+ for (Iterator baseIter = basePage.getChildren().iterator();
baseIter
+ .hasNext();) {
+
+ DocPage child = (DocPage) baseIter.next();
+
+ toc.append("<li>").append("<a href=\"");
+ for (int i = 1; i <= currentPage.getDepth(); i++) {
+ toc.append("../");
+ }
+
toc.append(child.getLinkPath()).append("/index.html\">");
+ toc.append(child.getTitle()).append("</a>");
+ if (child.hasDescendent(currentPage)) {
+ // render children
+ iterateChildren(toc, currentPage, child);
+ }
- toc.append("</li>\n");
- }
+ toc.append("</li>\n");
+ }
- toc.append("</ul>\n");
- }
+ toc.append("</ul>\n");
+ }
}
Modified:
incubator/cayenne/main/trunk/other/cayenne-regression-profiler/.settings/org.eclipse.jdt.core.prefs
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/other/cayenne-regression-profiler/.settings/org.eclipse.jdt.core.prefs?rev=434548&r1=434547&r2=434548&view=diff
==============================================================================
---
incubator/cayenne/main/trunk/other/cayenne-regression-profiler/.settings/org.eclipse.jdt.core.prefs
(original)
+++
incubator/cayenne/main/trunk/other/cayenne-regression-profiler/.settings/org.eclipse.jdt.core.prefs
Thu Aug 24 15:32:35 2006
@@ -1,4 +1,4 @@
-#Sun Nov 06 11:58:01 MSK 2005
+#Thu Aug 24 07:24:23 MDT 2006
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
Added: incubator/cayenne/main/trunk/other/confluence-maven-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/other/confluence-maven-plugin/pom.xml?rev=434548&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/other/confluence-maven-plugin/pom.xml (added)
+++ incubator/cayenne/main/trunk/other/confluence-maven-plugin/pom.xml Thu Aug
24 15:32:35 2006
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <parent>
+ <artifactId>cayenne-other-parent</artifactId>
+ <groupId>org.apache.cayenne.other</groupId>
+ <version>3.0-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.cayenne.other.plugin.confluence</groupId>
+ <artifactId>confluence-maven-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Cayenne Maven2 Plugins :: Confluence</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cayenne.other</groupId>
+ <artifactId>cayenne-build-tools</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/org/apache/cayenne/other/plugin/confluence/ConfluenceExportMojo.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/org/apache/cayenne/other/plugin/confluence/ConfluenceExportMojo.java?rev=434548&view=auto
==============================================================================
---
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/org/apache/cayenne/other/plugin/confluence/ConfluenceExportMojo.java
(added)
+++
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/main/java/org/apache/cayenne/other/plugin/confluence/ConfluenceExportMojo.java
Thu Aug 24 15:32:35 2006
@@ -0,0 +1,195 @@
+/*****************************************************************
+ * 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.cayenne.other.plugin.confluence;
+
+import java.net.URL;
+
+import org.apache.cayenne.tools.ant.docgen.DocGenerator;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * A goal to export confluence documentation
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Bill Dudney</a>
+ * @version $Id$
+ *
+ * @goal export
+ */
+public class ConfluenceExportMojo extends AbstractMojo {
+ /**
+ * The directory to put the exported documentation into
+ *
+ * @parameter
expression="${project.build.directory}/${export.spaceName}"
+ */
+ private String outputDirectory;
+
+ /**
+ * The velocity template to use - defaults to
+ * loading 'doctemplates/default.vm' from the classpath
+ *
+ * @parameter
+ */
+ private String velocityTemplate;
+
+ /**
+ * The root url to the confluence instance
+ * For example in Cayenne: http://cwiki.apache.org/confluence/
+ * is the root URL and the space name is CAYDOC
+ *
+ * @parameter expression="${export.rootURL}"
+ * @required
+ */
+ private URL rootURL;
+
+ /**
+ * The name of the confluence space to export
+ *
+ * @parameter expression="${export.spaceName}"
+ * @required
+ */
+ private String spaceName;
+
+ /**
+ * The page in the space to start with
+ *
+ * @parameter expression="${export.startPage}"
+ * @required
+ */
+ private String startPage;
+
+ /**
+ * The username to log in as - define it on the commandline via the
+ * -Dconfluence.userName=user_name option
+ * or set the userName and password in your ~/.m2/settings.xml file
+ * like this;
+ * <pre>
+ <profiles>
+ <profile>
+ <properties>
+ <property>
+ <name>confluence.userName</name>
+ <value>user name</value>
+ </property>
+ <property>
+ <name>confluence.password</name>
+ <value>password</value>
+ </property>
+ </properties>
+ <id>confluence</id>
+ </profile>
+ </profiles>
+ * </pre>
+ * @parameter expression="${confluence.userName}"
+ * @required
+ */
+ private String userName;
+
+ /**
+ * The username to log in as - define it on the commandline via the
+ * -Dconfluence.password=password option
+ *
+ * @parameter expression="${confluence.password}"
+ * @required
+ */
+ private String password;
+
+ /**
+ * where the actual work takes place
+ */
+ public void execute() throws MojoExecutionException,
MojoFailureException {
+ getLog().info("Exporting space '" + spaceName + "' to " +
outputDirectory);
+
+ try {
+ DocGenerator generator = new DocGenerator(
+ rootURL.toString(),
+ spaceName,
+ outputDirectory,
+ startPage,
+ userName,
+ password,
+ velocityTemplate);
+
+ getLog().info("Confluence base URL '" + generator.getBaseUrl() +
"'");
+ generator.generateDocs();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new MojoExecutionException("Failed to export: " + spaceName
+ " from: " + rootURL, e);
+ }
+ }
+
+ public String getOutputDirectory() {
+ return outputDirectory;
+ }
+
+ public void setOutputDirectory(String outputDirectory) {
+ this.outputDirectory = outputDirectory;
+ }
+
+ public String getVelocityTemplate() {
+ return velocityTemplate;
+ }
+
+ public void setVelocityTemplate(String velocityTemplate) {
+ this.velocityTemplate = velocityTemplate;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public URL getRootURL() {
+ return rootURL;
+ }
+
+ public void setRootURL(URL rootURL) {
+ this.rootURL = rootURL;
+ }
+
+ public String getSpaceName() {
+ return spaceName;
+ }
+
+ public void setSpaceName(String spaceName) {
+ this.spaceName = spaceName;
+ }
+
+ public String getStartPage() {
+ return startPage;
+ }
+
+ public void setStartPage(String startPage) {
+ this.startPage = startPage;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+}
Added:
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/org/apache/cayenne/other/plugin/confluence/ConfluenceExportMojoTest.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/org/apache/cayenne/other/plugin/confluence/ConfluenceExportMojoTest.java?rev=434548&view=auto
==============================================================================
---
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/org/apache/cayenne/other/plugin/confluence/ConfluenceExportMojoTest.java
(added)
+++
incubator/cayenne/main/trunk/other/confluence-maven-plugin/src/test/java/org/apache/cayenne/other/plugin/confluence/ConfluenceExportMojoTest.java
Thu Aug 24 15:32:35 2006
@@ -0,0 +1,39 @@
+package org.apache.cayenne.other.plugin.confluence;
+
+import junit.framework.TestCase;
+
+public class ConfluenceExportMojoTest extends TestCase {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(ConfluenceExportMojoTest.class);
+ }
+
+ public ConfluenceExportMojoTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*
+ * Test method for
'org.apache.cayenne.other.plugin.confluence.ConfluenceExportMojo.execute()'
+ */
+ public void testExecute() throws Exception {
+ /*
+ ConfluenceExportMojo mojo = new ConfluenceExportMojo();
+ mojo.setOutputDirectory("/tmp");
+ mojo.setPassword("your passwd here");
+ mojo.setUserName("your user id here");
+ mojo.setRootURL(new URL("http://cwiki.apache.org/confluence"));
+ mojo.setSpaceName("CAYDOC");
+ mojo.setStartPage("Documentation");
+ mojo.execute();
+ */
+ }
+
+}
Modified: incubator/cayenne/main/trunk/other/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/other/pom.xml?rev=434548&r1=434547&r2=434548&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/other/pom.xml (original)
+++ incubator/cayenne/main/trunk/other/pom.xml Thu Aug 24 15:32:35 2006
@@ -37,6 +37,8 @@
<modules>
<module>cayenne-regression-profiler</module>
+ <module>build-tools</module>
+ <module>confluence-maven-plugin</module>
</modules>
</project>