Skip to content
Permalink
Browse files
Copy cxf site builder over
  • Loading branch information
dkulp committed Nov 5, 2021
0 parents commit 77215b884b0b2d880ffb862dd26a9abdf9648e6a
Showing 21 changed files with 3,724 additions and 0 deletions.
@@ -0,0 +1,13 @@
github:
description: "Apache CXF website"
homepage: https://cxf.apache.org/

staging:
profile: ~
whoami: asf-staging


notifications:
commits: commits@cxf.apache.org
issues: issues@cxf.apache.org
pullrequests: dev@cxf.apache.org
@@ -0,0 +1 @@
target
40 README
@@ -0,0 +1,40 @@

This is the start of an export utility to export the CXF
confluence spaces to the sites. To run this manually, you need to
have a copy of the CXF website checked out to a local directory:

svn checkout https://svn.apache.org/repos/infra/websites/production/cxf/content

Build:
mvn install

You will need to pass credentials for a valid confluence user. This can be
done in one of two ways:

1) Command line:
-Dconfluence.user=username -Dconfluence.password=password

2) Profile in .m2/settings.xml
<profile>
<id>confluence</id>
<properties>
<confluence.user>user</confluence.user>
<confluence.password>passwd</confluence.password>
</properties>
</profile>

To export the space:
mvn -Pconfluence exec:java -Dcxf.site.output=/path/to/content
should appear in /path/to/content/

In the confluence profile above, you could add a property like:
<cxf.site.output>/path/to/content</cxf.site.output>
to simplify passing that into the command.

When you commit any changes in the content directory, the changes
should be "live" fairly quickly due to the svnpubsub process.





Empty file.
169 pom.xml
@@ -0,0 +1,169 @@
<!--
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cxf.site-export</groupId>
<artifactId>cxf-site-export</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Apache CXF Confluence Site Exporter</name>
<url>http://cxf.apache.org</url>

<parent>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-parent</artifactId>
<version>3.1.15</version>
</parent>

<properties>
<enforcer.skip>true</enforcer.skip>
<cxf.version>3.1.15</cxf.version>
<extra.arg></extra.arg>
<svn.arg1></svn.arg1>
<svn.arg2></svn.arg2>
<site.output>${basedir}/content</site.output>
<cxf.site.output>${site.output}</cxf.site.output>
<!--maven.test.skip>true</maven.test.skip-->
</properties>

<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-features-clustering</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</dependency>
<dependency>
<groupId>org.ccil.cowan.tagsoup</groupId>
<artifactId>tagsoup</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.4</version>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>org.apache.cxf.cwiki.SiteExporter</mainClass>
<arguments>
<argument>-d</argument>
<argument>${cxf.site.output}</argument>
<argument>-password</argument>
<argument>${confluence.password}</argument>
<argument>-user</argument>
<argument>${confluence.user}</argument>
<argument>${extra.arg}</argument>
<argument>${svn.arg1}</argument>
<argument>${svn.arg2}</argument>
<!--argument>-force</argument-->
<argument>${basedir}/template/main.cfg</argument>
<argument>${basedir}/template/docs.cfg</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-wadl2java-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
<wadlOptions>
<wadlOption>
<wadl>${basedir}/src/main/resources/confluence-rest.wadl</wadl>
</wadlOption>
</wadlOptions>
</configuration>
<goals>
<goal>wadl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>


<profiles>
<profile>
<id>svn</id>
<properties>
<svn.arg1>-svn</svn.arg1>
<svn.arg2>-commit</svn.arg2>
</properties>
</profile>
<profile>
<id>forceAll</id>
<properties>
<svn.arg1>-force</svn.arg1>
</properties>
</profile>
</profiles>
</project>
@@ -0,0 +1,123 @@
/**
* 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.cxf.cwiki;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import org.w3c.dom.Element;

import org.apache.cxf.helpers.DOMUtils;

/**
*
*/
public class AbstractPage implements Serializable {

private static final long serialVersionUID = 1L;

final String id;
final String title;
final String url;

Map<String, String> attachments;

transient String directory;

public AbstractPage(Element root) throws Exception {
// org.apache.cxf.helpers.XMLUtils.printDOM(doc.getDocumentElement());

id = DOMUtils.getChildContent(root, "id");
title = DOMUtils.getChildContent(root, "title");
url = DOMUtils.getChildContent(root, "url");
}

public AbstractPage(AbstractPage source) {
this.id = source.id;
this.title = source.title;
this.url = source.url;
this.directory = source.directory;
}

public String getDirectory() {
return directory == null ? "" : directory;
}

public String getPath() {
return getDirectory() + createFileName();
}

public String createFileName() {
StringBuffer buffer = new StringBuffer();
char array[] = title.toLowerCase().toCharArray();
boolean separated = true;
for (int x = 0; x < array.length; x++) {
if ("abcdefghijklmnopqrstuvwxyz0123456789".indexOf(array[x]) >= 0) {
buffer.append(Character.toLowerCase(array[x]));
separated = false;
} else if ("\r\n\t -".indexOf(array[x]) >= 0) {
if (separated) {
continue;
}
buffer.append('-');
separated = true;
}
}
if (buffer.length() == 0) {
return id + ".html";
}
return buffer.append(".html").toString();
}

public String getId() {
return id;
}

public String getTitle() {
return title;
}

public String getURL() {
return url;
}

public boolean getHasCode() {
return false;
}

public String toString() {
return "AbstractPage[id=" + id + ",title=" + title + ",url=" + url + "]";
}

public void addAttachment(String aid, String filename) {
if (attachments == null) {
attachments = new HashMap<String, String>();
}
attachments.put(aid, filename);
}
public String getAttachmentFilename(String aid) {
if (attachments == null) {
return null;
}
return attachments.get(aid);
}

}

0 comments on commit 77215b8

Please sign in to comment.