Merged in changes from trunk git-svn-id: https://svn.apache.org/repos/asf/rave/branches/mongo@1428516 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml index 0cc495d..d165168 100644 --- a/pom.xml +++ b/pom.xml
@@ -87,6 +87,7 @@ $mvn filesync:generate -Dmaven.filesync.override=true --> <maven.filesync.override>false</maven.filesync.override> + <cargo.version>1.3.1</cargo.version> <!-- default empty javaagent if needed you can specify it on the command line with -Djavaagent="..." --> <javaagent/> @@ -728,6 +729,7 @@ <module>rave-demo-gadgets</module> <module>rave-portal</module> <module>rave-integration-tests</module> + <module>rave-custom-project-archetype</module> </modules> <profiles> <profile>
diff --git a/rave-custom-project-archetype/pom.xml b/rave-custom-project-archetype/pom.xml new file mode 100644 index 0000000..edf8156 --- /dev/null +++ b/rave-custom-project-archetype/pom.xml
@@ -0,0 +1,178 @@ +<?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> + <groupId>org.apache.rave</groupId> + <artifactId>rave-project</artifactId> + <version>0.19-SNAPSHOT</version> + </parent> + + <artifactId>rave-custom-project-archetype</artifactId> + <packaging>maven-archetype</packaging> + + <name>Apache Rave :: rave-custom-project-archetype</name> + <description>An Archetype to create a custom Apache Rave project</description> + + <properties> + <customproject.app.groupId>org.apache.rave.custom</customproject.app.groupId> + <customproject.app.artifactId>myproject</customproject.app.artifactId> + <customproject.app.version>${project.version}</customproject.app.version> + <customproject.app.name>My Custom Rave Project</customproject.app.name> + </properties> + + <!-- + Replace some property values in the archetype pom upon generation of the archetype, see + http://stackoverflow.com/questions/7223031/how-to-embed-archetype-project-version-in-maven-archetype + --> + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + <includes> + <include>archetype-resources/pom.xml</include> + </includes> + </resource> + <resource> + <directory>src/main/resources</directory> + <filtering>false</filtering> + <excludes> + <exclude>archetype-resources/pom.xml</exclude> + </excludes> + </resource> + </resources> + + <extensions> + <extension> + <groupId>org.apache.maven.archetype</groupId> + <artifactId>archetype-packaging</artifactId> + <version>2.2</version> + </extension> + </extensions> + + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-archetype-plugin</artifactId> + <version>2.2</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <configuration> + <escapeString>\</escapeString> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-archetype-plugin</artifactId> + <version>2.2</version> + <extensions>true</extensions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.7</version> + <executions> + <execution> + <id>generate-and-install-custom-rave-project</id> + <phase>install</phase> + <configuration> + <target> + <echo message="$$$$$$$$$$ Deleting the existing custom Rave project if it exists. $$$$$$$$$$"/> + <delete dir="${project.build.directory}/${customproject.app.artifactId}"/> + + <echo message="$$$$$$$$$$ Generating a custom Rave project from the archetype $$$$$$$$$$"/> + <java classname="org.codehaus.classworlds.Launcher" dir="${project.build.directory}" + fork="true" failonerror="true"> + <permissions> + <grant class="java.security.AllPermission"/> + <grant class="java.io.FilePermission" name="${maven.home}/bin/m2.conf" + actions="read"/> + <grant class="java.util.PropertyPermission" name="*" actions="read,write"/> + </permissions> + <sysproperty key="classworlds.conf" value="${maven.home}/bin/m2.conf"/> + <sysproperty key="maven.home" value="${maven.home}"/> + <classpath> + <fileset dir="${maven.home}/boot"> + <include name="**/*.jar"/> + </fileset> + </classpath> + <arg value="-B"/> + <arg value="org.apache.maven.plugins:maven-archetype-plugin:2.2:generate"/> + <arg value="-DarchetypeCatalog=local"/> + <arg value="-DarchetypeGroupId=org.apache.rave"/> + <arg value="-DarchetypeArtifactId=rave-custom-project-archetype"/> + <arg value="-DarchetypeVersion=${project.version}"/> + <arg value="-DgroupId=${customproject.app.groupId}"/> + <arg value="-DartifactId=${customproject.app.artifactId}"/> + <arg value="-Dversion=${customproject.app.version}"/> + <arg value="-DprojectName=${customproject.app.name}"/> + <arg value="-Dmaven.repo.local=${settings.localRepository}"/> + </java> + + <echo message="$$$$$$$$$$ Installing custom Rave project $$$$$$$$$$"/> + <java classname="org.codehaus.classworlds.Launcher" + dir="${project.build.directory}/${customproject.app.artifactId}" fork="true" + failonerror="true"> + <permissions> + <grant class="java.security.AllPermission"/> + <grant class="java.io.FilePermission" name="${maven.home}/bin/m2.conf" + actions="read"/> + <grant class="java.util.PropertyPermission" name="*" actions="read,write"/> + </permissions> + <sysproperty key="classworlds.conf" value="${maven.home}/bin/m2.conf"/> + <sysproperty key="maven.home" value="${maven.home}"/> + <classpath> + <fileset dir="${maven.home}/boot"> + <include name="**/*.jar"/> + </fileset> + </classpath> + <arg value="package"/> + <arg value="-Dmaven.repo.local=${settings.localRepository}"/> + </java> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-archetype-plugin</artifactId> + <version>2.2</version> + <scope>runtime</scope> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + +</project>
diff --git a/rave-custom-project-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/rave-custom-project-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 0000000..ee3acc3 --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,92 @@ +<?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. + --> +<archetype-descriptor + xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" + name="rave-custom-project" + xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <requiredProperties> + <requiredProperty key="groupId"> + <defaultValue>org.example</defaultValue> + </requiredProperty> + <requiredProperty key="artifactId"> + <defaultValue>myraveproject</defaultValue> + </requiredProperty> + <requiredProperty key="version"> + <defaultValue>1.01.00-SNAPSHOT</defaultValue> + </requiredProperty> + <requiredProperty key="projectName"> + <defaultValue>My Rave Project</defaultValue> + </requiredProperty> + </requiredProperties> + <modules> + <module id="${rootArtifactId}-portal" dir="__rootArtifactId__-portal" name="${rootArtifactId}-portal"> + <fileSets> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>src/main/java</directory> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory>src/main/dist</directory> + <includes> + <include>**/*.xml</include> + </includes> + </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory>src/main/webapp</directory> + <includes> + <include>**/*.xml</include> + </includes> + </fileSet> + <fileSet encoding="UTF-8"> + <directory>src/main/webapp</directory> + <includes> + <include>**/*.tag</include> + <include>**/*.css</include> + </includes> + </fileSet> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>src/test/java</directory> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory>src/test/resources</directory> + <includes> + <include>**/*.xml</include> + </includes> + </fileSet> + </fileSets> + </module> + <module id="${rootArtifactId}-shindig" dir="__rootArtifactId__-shindig" name="${rootArtifactId}-shindig"> + <fileSets> + <fileSet filtered="true" encoding="UTF-8"> + <directory>src/main/webapp</directory> + <includes> + <include>**/*.xml</include> + </includes> + </fileSet> + </fileSets> + </module> + </modules> +</archetype-descriptor>
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/pom.xml b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/pom.xml new file mode 100644 index 0000000..f9c471b --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/pom.xml
@@ -0,0 +1,321 @@ +<?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"> + <parent> + <artifactId>${rootArtifactId}</artifactId> + <groupId>${groupId}</groupId> + <version>${version}</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>${artifactId}</artifactId> + <name>${projectName} :: ${artifactId}</name> + + <packaging>war</packaging> + + <properties> + <!-- if you want a remote debugging on a different a address + override on command line with -Dcargo.debug.addres=xxxx --> + <cargo.debug.address>8000</cargo.debug.address> + <!-- if you want to start remote debugging session suspended + override on command line with -Dcargo.debug.suspend=y --> + <cargo.debug.suspend>n</cargo.debug.suspend> + <cargo.args/> + </properties> + + <dependencyManagement> + <dependencies> + <!-- + spring-security-web has dependencies on older spring 3.0.x.RELEASE jars, + one of which is spring-aop. This causes some initialization issues so ensure that the spring-aop + version used is the desired version + --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${org.springframework.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + + <!-- servlet-api, jsp-api and el-api api must be scope provided --> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>${javax.servlet.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.servlet.jsp</groupId> + <artifactId>jsp-api</artifactId> + <version>${jsp-api.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.el</groupId> + <artifactId>el-api</artifactId> + <version>${el-api.version}</version> + <scope>provided</scope> + </dependency> + + <!-- Exclude commons-logging by adding it as a provided dependency --> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.1.1</version> + <scope>provided</scope> + </dependency> + + <!-- fore junit dependency on scope test --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.easymock</groupId> + <artifactId>easymock</artifactId> + <version>${easymock.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${org.springframework.version}</version> + <scope>test</scope> + </dependency> + + + <!-- Ensure/enforce proper version for commons-lang, not relying on transitive dependencies --> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>${commons-lang.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.rave</groupId> + <artifactId>rave-portal-dependencies</artifactId> + <type>pom</type> + <version>${apache.rave.version}</version> + <!-- exclude the LDAP integration (not used in this custom project) --> + <exclusions> + <exclusion> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-ldap</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.rave</groupId> + <artifactId>rave-portal-resources</artifactId> + <type>war</type> + <version>${apache.rave.version}</version> + </dependency> + + <dependency> + <groupId>${groupId}</groupId> + <artifactId>${rootArtifactId}-shindig</artifactId> + <type>war</type> + <version>${version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.wookie</groupId> + <artifactId>wookie</artifactId> + <type>war</type> + <version>${apache.wookie.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.rave</groupId> + <artifactId>rave-demo-gadgets</artifactId> + <type>war</type> + <version>${apache.rave.version}</version> + <scope>provided</scope> + </dependency> + + + <!-- Default database --> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>${com.h2database.version}</version> + </dependency> + + <!-- log4j logging --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>${org.slf4j.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>${log4j.version}</version> + <scope>runtime</scope> + </dependency> + + <!-- mail --> + <dependency> + <groupId>javax.mail</groupId> + <artifactId>mail</artifactId> + <version>${javax.mail.version}</version> + </dependency> + </dependencies> + + + <build> + <defaultGoal>install</defaultGoal> + <plugins> + <plugin> + <groupId>com.googlecode.mavenfilesync</groupId> + <artifactId>maven-filesync-plugin</artifactId> + <configuration> + <mappings> + <mapping> + <sourceFolder>src/main/webapp</sourceFolder> + <destinationFolder>@target/tomcat6x/webapps/portal</destinationFolder> + </mapping> + <mapping> + <sourceFolder>src/main/resources</sourceFolder> + <destinationFolder>@target/tomcat6x/webapps/portal/WEB-INF/classes</destinationFolder> + </mapping> + </mappings> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <configuration> + <overlays> + <overlay> + <groupId>org.apache.rave</groupId> + <artifactId>rave-portal-resources</artifactId> + <!-- Example exclusions for files we overrides + This isn't technically required (as we overlay) but made explicit this way + --> + <excludes> + <exclude>WEB-INF/applicationContext-security.xml</exclude> + <exclude>WEB-INF/xml</exclude> + </excludes> + </overlay> + </overlays> + </configuration> + </plugin> + + <plugin> + <groupId>org.codehaus.cargo</groupId> + <artifactId>cargo-maven2-plugin</artifactId> + <version>${cargo.version}</version> + <configuration> + <deployables> + <deployable> + <groupId>${groupId}</groupId> + <artifactId>${rootArtifactId}-shindig</artifactId> + <type>war</type> + <properties> + <context>/ROOT</context> + </properties> + </deployable> + <deployable> + <groupId>org.apache.rave</groupId> + <artifactId>rave-demo-gadgets</artifactId> + <type>war</type> + <!-- I tried giving this name gagdets and it did not work. --> + <properties> + <context>/demogadgets</context> + </properties> + </deployable> + <deployable> + <groupId>${groupId}</groupId> + <artifactId>${rootArtifactId}-portal</artifactId> + <type>war</type> + <properties> + <context>/portal</context> + </properties> + </deployable> + <deployable> + <groupId>org.apache.wookie</groupId> + <artifactId>wookie</artifactId> + <type>war</type> + <properties> + <context>/wookie</context> + </properties> + </deployable> + </deployables> + <configuration> + <properties> + <cargo.jvmargs><![CDATA[-Dh2.bindAddress="localhost" -Xdebug -Xrunjdwp:transport=dt_socket,address=${cargo.debug.address},server=y,suspend=${cargo.debug.suspend} -noverify ${javaagent} ${cargo.args}]]></cargo.jvmargs> + <cargo.tomcat.context.reloadable>true</cargo.tomcat.context.reloadable> + </properties> + <home>${project.build.directory}/tomcat6x</home> + <configfiles> + <configfile> + <file>${project.basedir}/../${rootArtifactId}-portal/src/main/dist/conf/tomcat-users.xml</file> + <todir>conf/</todir> + <tofile>tomcat-users.xml</tofile> + </configfile> + </configfiles> + </configuration> + <container> + <containerId>tomcat6x</containerId> + <timeout>180000</timeout> + <zipUrlInstaller> + <downloadDir>${settings.localRepository}/org/codehaus/cargo/cargo-container-archives</downloadDir> + <url>http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.tar.gz</url> + </zipUrlInstaller> + <systemProperties> + <net.sf.ehcache.skipUpdateCheck>true</net.sf.ehcache.skipUpdateCheck> + <!-- un-comment following property for: Loading the SizeOfAgent will probably fail, + as you are running on Apple OS X and have a value set for java.io.tmpdir --> + <!-- <net.sf.ehcache.pool.sizeof.AgentSizeOf.bypass>true</net.sf.ehcache.pool.sizeof.AgentSizeOf.bypass> --> + + <!-- Documentation: http://incubator.apache.org/rave/documentation/host-configuration.html --> + <!-- + <portal.override.properties>/path/to/custom.portal.properties</portal.override.properties> + <rave-shindig.override.properties>/path/to/custom.shindig.properties</rave-shindig.override.properties> + <shindig.host>localhost</shindig.host> + <shindig.port>8080</shindig.port> + <shindig.contextroot /> + --> + </systemProperties> + </container> + </configuration> + </plugin> + + </plugins> + </build> + +</project>
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/dist/conf/tomcat-users.xml b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/dist/conf/tomcat-users.xml new file mode 100644 index 0000000..6eeef10 --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/dist/conf/tomcat-users.xml
@@ -0,0 +1,26 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +<?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. + --> +<tomcat-users> +<role rolename="widgetadmin"/> +<user username="java" password="java" roles="widgetadmin"/> +</tomcat-users>
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/java/CustomUserService.java b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/java/CustomUserService.java new file mode 100644 index 0000000..851cad9 --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/java/CustomUserService.java
@@ -0,0 +1,119 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 ${package}; + +import org.apache.rave.portal.model.User; +import org.apache.rave.portal.repository.CategoryRepository; +import org.apache.rave.portal.repository.PageRepository; +import org.apache.rave.portal.repository.PageTemplateRepository; +import org.apache.rave.portal.repository.PersonRepository; +import org.apache.rave.portal.repository.UserRepository; +import org.apache.rave.portal.repository.WidgetRepository; +import org.apache.rave.portal.service.impl.DefaultUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +/* + * 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. + */ + +/** + * Custom User service is to demonstrate how you can implement a custom + * {@link ${groupId}.portal.service.UserService} in Apache Rave and add additional information + */ + +@Service(value = "customUserService") +public class CustomUserService extends DefaultUserService { + private static final Logger logger = LoggerFactory.getLogger(CustomUserService.class); + private final UserRepository userRepository; + + @Autowired + public CustomUserService(UserRepository userRepository, + PageRepository pageRepository, + WidgetRepository widgetRepository, + PageTemplateRepository pageTemplateRepository, + CategoryRepository categoryRepository, + PersonRepository personRepository) { + super(pageRepository, userRepository, widgetRepository,pageTemplateRepository, categoryRepository,personRepository); + this.userRepository = userRepository; + } + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { + logger.info("Custom User Service called to get user information"); + final User user = userRepository.getByUsername(username); + if (user == null) { + throw new UsernameNotFoundException("User with username '" + username + "' was not found!"); + } + fetchCustomCredential(user); + return user; + } + + /** + * This method attempts to load the custom credential and decorates it with + * additional attributes. + * + * @param user for whom the custom credentials are fetched + */ + private void fetchCustomCredential(User user) { + try { + logger.info("Decorating the credential for user {}", user.getUsername()); + } catch (Exception e) { + logger.warn("Unexpected error while fetching custom credentials", e); + } + } + + @Override + public User getAuthenticatedUser() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + + if (authentication != null && authentication.getPrincipal() instanceof User) { + return (User) authentication.getPrincipal(); + } else { + throw new SecurityException("Could not get the authenticated user!"); + } + } + +}
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/WEB-INF/applicationContext-security.xml b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/WEB-INF/applicationContext-security.xml new file mode 100644 index 0000000..14c9080 --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/WEB-INF/applicationContext-security.xml
@@ -0,0 +1,99 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +<?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. + --> + +<!-- + This security file uses the default spring simple form login +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:security="http://www.springframework.org/schema/security" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"> + + <security:http auto-config="true" use-expressions="true" disable-url-rewriting="true"> + <security:intercept-url pattern="/static/**" access="permitAll"/> + <security:intercept-url pattern="/login" access="permitAll"/> + <security:intercept-url pattern="/newaccount.jsp*" access="permitAll"/> + <security:intercept-url pattern="/app/newaccount*" access="permitAll"/> + <security:intercept-url pattern="/app/newpassword/**" access="permitAll"/> + <security:intercept-url pattern="/app/retrieveusername/**" access="permitAll"/> + <security:intercept-url pattern="/app/changepassword/**" access="permitAll"/> + <security:intercept-url pattern="/app/messagebundle/*.js" access="permitAll"/> + <security:intercept-url pattern="/app/admin/**" access="hasRole('ROLE_ADMIN')"/> <!-- all urls must be authenticated --> + <security:intercept-url pattern="/**" access="hasAnyRole('ROLE_USER','ROLE_ADMIN')"/> + + + <!-- Set the user service ref here to the implementation you want to use. The name is + defined in the @Service annotation of the corresponding service source code. + --> + <security:openid-login user-service-ref="customUserService" authentication-failure-handler-ref="openIdAuthFailureHandler"> + <security:attribute-exchange identifier-match="https://www.google.com.*"> + <security:openid-attribute name="email" type="http://axschema.org/contact/email" required="true" count="1"/> + <security:openid-attribute name="firstname" type="http://axschema.org/namePerson/first" required="true"/> + <security:openid-attribute name="lastname" type="http://axschema.org/namePerson/last" required="true"/> + </security:attribute-exchange> + <security:attribute-exchange identifier-match=".*openid-provider.appspot.com.*"> + <security:openid-attribute name="email" type="http://axschema.org/contact/email" required="true" count="1"/> + <security:openid-attribute name="firstname" type="http://axschema.org/namePerson/first" required="true"/> + <security:openid-attribute name="lastname" type="http://axschema.org/namePerson/last" required="true"/> + </security:attribute-exchange> + <security:attribute-exchange identifier-match=".*yahoo.com.*"> + <security:openid-attribute name="email" type="http://axschema.org/contact/email" required="true"/> + <security:openid-attribute name="fullname" type="http://axschema.org/namePerson" required="true"/> + </security:attribute-exchange> + <security:attribute-exchange identifier-match=".*myopenid.com.*"> + <security:openid-attribute name="email" type="http://schema.openid.net/contact/email" required="true" count="1"/> + <security:openid-attribute name="fullname" type="http://schema.openid.net/namePerson" required="true"/> + </security:attribute-exchange> + </security:openid-login> + <security:form-login login-page="/login" default-target-url="/" authentication-failure-url="/login?authfail=form" /> + <security:logout/> + </security:http> + + <security:authentication-manager> + <!-- Set the user service ref here to the implementation you want to use. The name is + defined in the @Service annotation of the corresponding service source code. + --> + <security:authentication-provider user-service-ref="customUserService"> + <security:password-encoder ref="passwordEncoder" /> + </security:authentication-provider> + <!-- No LDAP authentication in this custom project --> + </security:authentication-manager> + + <bean id="openIdAuthFailureHandler" class="org.apache.rave.portal.web.controller.handler.OpenIDAuthenticationFailureHandler"> + <property name="defaultFailureUrl" value="/login?authfail=openid"/> + </bean> + + <!-- enable the spring security annotations --> + <security:global-method-security secured-annotations="enabled" pre-post-annotations="enabled"> + <security:expression-handler ref="expressionHandler"/> + </security:global-method-security> + <!-- override the default permissionEvaluator bean used by Spring Security with our custom RavePermissionEvaluator --> + <bean id="expressionHandler" class="org.apache.rave.portal.security.impl.RaveMethodSecurityExpressionHandler"> + <property name="permissionEvaluator" ref="ravePermissionEvaluator" /> + </bean> + + <!-- Need to define customUserService because its package is not scanned automatically --> + <bean id="customUserService" class="${package}.CustomUserService"/> + +</beans>
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/WEB-INF/tags/custom_css.tag b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/WEB-INF/tags/custom_css.tag new file mode 100644 index 0000000..048cdae --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/WEB-INF/tags/custom_css.tag
@@ -0,0 +1,22 @@ +<%@ tag language="java" pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%> +<%-- + 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. + --%> + +<link rel="stylesheet" href="<c:url value="/static/css/custom.css" />" />
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/WEB-INF/web.xml b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..6a58556 --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,79 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +<?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. + --> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://java.sun.com/xml/ns/javaee" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + id="Shindig" + version="2.5"> + + <display-name>Rave Portal</display-name> + + <context-param> + <param-name>contextConfigLocation</param-name> + <param-value> + /WEB-INF/dataContext.xml + /WEB-INF/applicationContext.xml + /WEB-INF/applicationContext-security.xml + </param-value> + </context-param> + <listener> + <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> + </listener> + <filter> + <filter-name>springSecurityFilterChain</filter-name> + <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> + </filter> + <filter-mapping> + <filter-name>springSecurityFilterChain</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <!-- Handles all requests into the application --> + <servlet> + <servlet-name>dispatcher</servlet-name> + <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> + + <servlet-mapping> + <servlet-name>dispatcher</servlet-name> + <url-pattern>/app/*</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>dispatcher</servlet-name> + <url-pattern>/index.html</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>dispatcher</servlet-name> + <url-pattern>/login</url-pattern> + </servlet-mapping> + + <welcome-file-list> + <welcome-file>index.html</welcome-file> + </welcome-file-list> + + <error-page> + <exception-type>java.lang.Throwable</exception-type> + <location>/WEB-INF/jsp/views/error.jsp</location> + </error-page> +</web-app>
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/static/css/custom.css b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/static/css/custom.css new file mode 100644 index 0000000..9e6d05b --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/main/webapp/static/css/custom.css
@@ -0,0 +1,52 @@ +/* + * 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. + */ + +body{ +height:100%; +} + +body, #pageContent{ +background-color:#ffffff; +background-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzllY2ZmNSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); +background-size:100%; +background-image:-webkit-gradient(linear,50% 0,50% 320,color-stop(0%,#9ecff5),color-stop(100%,#fff)); +background-image:-webkit-linear-gradient(top,#9ecff5,#fff 320px); +background-image:-moz-linear-gradient(top,#9ecff5,#fff 320px); +background-image:-o-linear-gradient(top,#9ecff5,#fff 320px); +background-image:-ms-linear-gradient(top,#9ecff5,#fff 320px); +background-image:linear-gradient(top,#9ecff5,#fff 320px); +background-repeat:no-repeat;background-image:-webkit-gradient(linear,0 0,0 320,from(#9ecff5),to(white)); +} +.page { +padding: 40px!important; +} + +.dialog.center { +left: 50%; +margin-left: -265px; +margin-top: -160px; +position: absolute; +top: 20%; +width: 500px; +} + +.dialog_content { +position: relative; +padding-bottom: 65px; +}
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/test/java/CustomUserServiceTest.java b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/test/java/CustomUserServiceTest.java new file mode 100644 index 0000000..4fa00f0 --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/test/java/CustomUserServiceTest.java
@@ -0,0 +1,137 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 ${package}; + +import org.apache.rave.portal.model.User; +import org.apache.rave.portal.model.impl.UserImpl; +import org.apache.rave.portal.repository.CategoryRepository; +import org.apache.rave.portal.repository.PageRepository; +import org.apache.rave.portal.repository.PageTemplateRepository; +import org.apache.rave.portal.repository.PersonRepository; +import org.apache.rave.portal.repository.UserRepository; +import org.apache.rave.portal.repository.WidgetRepository; +import org.junit.Before; +import org.junit.Test; +import org.springframework.security.authentication.TestingAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UsernameNotFoundException; + +import java.util.ArrayList; +import java.util.List; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertFalse; +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.expectLastCall; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.verify; + +/* + * 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. + */ + +/** + * Test class for {@link CustomUserService} + */ +public class CustomUserServiceTest { + + private UserRepository repository; + private CustomUserService userService; + + @Before + public void setUp() throws Exception { + repository = createMock(UserRepository.class); + userService = new CustomUserService(repository, + createMock(PageRepository.class), + createMock(WidgetRepository.class), + createMock(PageTemplateRepository.class), + createMock(CategoryRepository.class), + createMock(PersonRepository.class)); + } + + @Test + public void testLoadUserByUsername() throws Exception { + final String username = "canonical"; + User user = new UserImpl("1", username); + expect(repository.getByUsername(username)).andReturn(user); + replay(repository); + + UserDetails returnedUser = userService.loadUserByUsername(username); + verify(repository); + assertEquals(returnedUser, user); + } + + @Test(expected = UsernameNotFoundException.class) + public void testLoadUserByUsername_fail() throws Exception { + final String username = "missing"; + + expect(repository.getByUsername(username)).andReturn(null); + expectLastCall(); + replay(repository); + + userService.loadUserByUsername(username); + + assertFalse("Method should throw Exception", true); + } + + @Test + public void testGetAuthenticatedUser() throws Exception { + List<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>(); + grantedAuthorities.add(new SimpleGrantedAuthority("ROLE_USER")); + UserDetails userDetails = new UserImpl("1", "canonical"); + Authentication authentication = new TestingAuthenticationToken(userDetails, "canonical", grantedAuthorities); + SecurityContextHolder.getContext().setAuthentication(authentication); + + User returnedUser = userService.getAuthenticatedUser(); + assertEquals(returnedUser, userDetails); + } + + @Test(expected = SecurityException.class) + public void testGetAuthenticatedUser_fail() throws Exception { + SecurityContextHolder.getContext().setAuthentication(null); + + userService.getAuthenticatedUser(); + + assertFalse("Method should throw Exception", true); + } +}
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/test/resources/log4j.xml b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/test/resources/log4j.xml new file mode 100644 index 0000000..83b4c2b --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-portal/src/test/resources/log4j.xml
@@ -0,0 +1,54 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +<?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. + --> +<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd"> +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> + + <!-- Appenders --> + <appender name="console" class="org.apache.log4j.ConsoleAppender"> + <param name="Target" value="System.out" /> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%-5p: %c - %m%n" /> + </layout> + </appender> + + <!-- Springframework logger --> + <logger name="org.springframework"> + <level value="info" /> + </logger> + + <!-- Rave logger --> + <logger name="org.apache.rave"> + <level value="debug" /> + </logger> + + <logger name="${groupId}"> + <level value="debug" /> + </logger> + + <!-- Root Logger --> + <root> + <priority value="warn" /> + <appender-ref ref="console" /> + </root> + +</log4j:configuration>
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-shindig/pom.xml b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-shindig/pom.xml new file mode 100644 index 0000000..c2c29f2 --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-shindig/pom.xml
@@ -0,0 +1,93 @@ +<?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"> + <parent> + <artifactId>${rootArtifactId}</artifactId> + <groupId>${groupId}</groupId> + <version>${version}</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>${artifactId}</artifactId> + <name>${projectName} :: ${artifactId}</name> + <packaging>war</packaging> + + <dependencies> + <dependency> + <groupId>org.apache.rave</groupId> + <artifactId>rave-shindig</artifactId> + <type>war</type> + <version>${apache.rave.version}</version> + </dependency> + </dependencies> + + <build> + <defaultGoal>install</defaultGoal> + <testResources> + <testResource> + <directory>src/test/resources</directory> + <filtering>true</filtering> + </testResource> + </testResources> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <configuration> + <overlays> + <overlay> + <groupId>org.apache.rave</groupId> + <artifactId>rave-shindig</artifactId> + <!-- Example exclusions for files we overrides + This isn't technically required (as we overlay) but made explicit this way + --> + <excludes> + <exclude>WEB-INF/web.xml</exclude> + </excludes> + </overlay> + </overlays> + </configuration> + </plugin> + <plugin> + <groupId>com.googlecode.mavenfilesync</groupId> + <artifactId>maven-filesync-plugin</artifactId> + <configuration> + <mappings> + <mapping> + <sourceFolder>src/main/webapp</sourceFolder> + <destinationFolder>@../${rootArtifactId}-portal/target/tomcat6x/webapps/ROOT</destinationFolder> + </mapping> + <mapping> + <sourceFolder>src/main/resources</sourceFolder> + <destinationFolder>@../${rootArtifactId}-portal/target/tomcat6x/webapps/ROOT/WEB-INF/classes</destinationFolder> + </mapping> + </mappings> + </configuration> + </plugin> + </plugins> + </build> +</project>
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-shindig/src/main/webapp/WEB-INF/web.xml b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-shindig/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..07db72a --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__-shindig/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,355 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +<?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. + --> + +<!-- + Exact copy of rave-shindig/src/main/webapp/WEB-INF/web.xml + Maven cannot compile a war without a web.xml +--> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://java.sun.com/xml/ns/javaee" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + id="Shindig" + version="2.5"> + <display-name>Shindig</display-name> + + <!-- Spring context configuration --> + <context-param> + <param-name>contextConfigLocation</param-name> + <param-value> + classpath:rave-shindig-applicationContext.xml + classpath:rave-shindig-dataContext.xml + classpath:modules-context.xml + </param-value> + </context-param> + + <!-- + Syntax: <key>=<value> separated by a newline + + system.properties specifies the environmental variables that will be set to the JVM System Properties at server startup time. + Alternatively, you may add these values in your app server (ex: Tomcat) as + VM arguments like this: -Dshindig.host="my.production.shindig.server.com". + + Here are a few properties that can be set for Shindig: + shindig.host: the server name that Shindig is deployed and running on + shindig.port: the port number of shindig.host server + + Make sure you escape all HTML values for the web.xml to be parsed correctly. + --> + <context-param> + <param-name>system.properties</param-name> + <param-value> + <![CDATA[ + shindig.host= + shindig.port= + aKey=/shindig/gadgets/proxy?container=default&url= + ]]> + </param-value> + </context-param> + + <filter> + <filter-name>hostFilter</filter-name> + <filter-class>org.apache.shindig.common.servlet.HostFilter</filter-class> + </filter> + <filter-mapping> + <filter-name>hostFilter</filter-name> + <url-pattern>/gadgets/ifr</url-pattern> + <url-pattern>/gadgets/js/*</url-pattern> + <url-pattern>/gadgets/proxy/*</url-pattern> + <url-pattern>/gadgets/concat</url-pattern> + <url-pattern>/gadgets/makeRequest</url-pattern> + <url-pattern>/rpc/*</url-pattern> + <url-pattern>/rest/*</url-pattern> + </filter-mapping> + + <filter> + <filter-name>ShiroFilter</filter-name> + <filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class> + <init-param> + <param-name>config</param-name> + <param-value> + <![CDATA[ + ${symbol_pound} The ShiroFilter configuration is very powerful and flexible, while still remaining succinct. + ${symbol_pound} Please read the comprehensive example, with full comments and explanations, in the JavaDoc: + ${symbol_pound} + ${symbol_pound} http://www.jsecurity.org/api/org/jsecurity/web/servlet/JSecurityFilter.html + [main] + shindigSampleRealm = org.apache.shindig.sample.shiro.SampleShiroRealm + securityManager.realm = ${symbol_dollar}shindigSampleRealm + authc.loginUrl = /login.jsp + + [urls] + ${symbol_pound} The /login.jsp is not restricted to authenticated users (otherwise no one could log in!), but + ${symbol_pound} the 'authc' filter must still be specified for it so it can process that url's + ${symbol_pound} login submissions. It is 'smart' enough to allow those requests through as specified by the + ${symbol_pound} shiro.loginUrl above. + /login.jsp = authc + + /oauth/authorize/** = authc + /oauth2/authorize/** = authc + ]]> + </param-value> + </init-param> + </filter> + + <filter> + <filter-name>authFilter</filter-name> + <filter-class>org.apache.shindig.auth.AuthenticationServletFilter</filter-class> + </filter> + + <filter> + <filter-name>etagFilter</filter-name> + <filter-class>org.apache.shindig.gadgets.servlet.ETagFilter</filter-class> + </filter> + + + <filter-mapping> + <filter-name>ShiroFilter</filter-name> + <url-pattern>/oauth/authorize</url-pattern> + </filter-mapping> + + <filter-mapping> + <filter-name>ShiroFilter</filter-name> + <url-pattern>/oauth2/authorize</url-pattern> + </filter-mapping> + + <filter-mapping> + <filter-name>ShiroFilter</filter-name> + <url-pattern>*.jsp</url-pattern> + </filter-mapping> + + <filter-mapping> + <filter-name>authFilter</filter-name> + <url-pattern>/social/*</url-pattern> + <url-pattern>/gadgets/ifr</url-pattern> + <url-pattern>/gadgets/makeRequest</url-pattern> + <url-pattern>/gadgets/api/rpc/*</url-pattern> + <url-pattern>/gadgets/api/rest/*</url-pattern> + <url-pattern>/rpc/*</url-pattern> + <url-pattern>/rest/*</url-pattern> + </filter-mapping> + + <filter-mapping> + <filter-name>etagFilter</filter-name> + <url-pattern>*</url-pattern> + </filter-mapping> + + <!-- + <listener> + <listener-class>org.apache.shindig.common.servlet.GuiceServletContextListener</listener-class> + </listener> + --> + + <!-- Initialize Spring LAST --> + <listener> + <listener-class>org.apache.rave.inject.GuiceBindingSpringContextLoaderListener</listener-class> + </listener> + + <!-- Render a Gadget --> + <servlet> + <servlet-name>xml-to-html</servlet-name> + <servlet-class> + org.apache.shindig.gadgets.servlet.GadgetRenderingServlet + </servlet-class> + </servlet> + + <servlet> + <servlet-name>accel</servlet-name> + <servlet-class> + org.apache.shindig.gadgets.servlet.HtmlAccelServlet + </servlet-class> + </servlet> + + <!-- Proxy --> + <servlet> + <servlet-name>proxy</servlet-name> + <servlet-class> + org.apache.shindig.gadgets.servlet.ProxyServlet + </servlet-class> + </servlet> + + <!-- makeRequest --> + <servlet> + <servlet-name>makeRequest</servlet-name> + <servlet-class> + org.apache.shindig.gadgets.servlet.MakeRequestServlet + </servlet-class> + </servlet> + + <!-- Concat --> + <servlet> + <servlet-name>concat</servlet-name> + <servlet-class> + org.apache.shindig.gadgets.servlet.ConcatProxyServlet + </servlet-class> + </servlet> + + <!-- OAuth callback --> + <servlet> + <servlet-name>oauthCallback</servlet-name> + <servlet-class> + org.apache.shindig.gadgets.servlet.OAuthCallbackServlet + </servlet-class> + </servlet> + + <!-- OAuth2 callback --> + <servlet> + <servlet-name>oauth2callback</servlet-name> + <servlet-class> + org.apache.shindig.gadgets.servlet.OAuth2CallbackServlet + </servlet-class> + </servlet> + + <!-- Metadata RPC --> + <servlet> + <servlet-name>metadata</servlet-name> + <servlet-class> + org.apache.shindig.gadgets.servlet.RpcServlet + </servlet-class> + </servlet> + + <!-- javascript serving --> + <servlet> + <servlet-name>js</servlet-name> + <servlet-class>org.apache.shindig.gadgets.servlet.JsServlet</servlet-class> + </servlet> + + <servlet> + <servlet-name>restapiServlet</servlet-name> + <servlet-class> + org.apache.shindig.protocol.DataServiceServlet + </servlet-class> + <init-param> + <param-name>handlers</param-name> + <param-value>org.apache.shindig.handlers</param-value> + </init-param> + </servlet> + + <!-- Serve social RPC api --> + <servlet> + <servlet-name>jsonRpcServlet</servlet-name> + <servlet-class> + org.apache.shindig.protocol.JsonRpcServlet + </servlet-class> + <init-param> + <param-name>handlers</param-name> + <param-value>org.apache.shindig.handlers</param-value> + </init-param> + </servlet> + + <!-- Serve sample OAuth apis --> + <servlet> + <servlet-name>sampleOAuth</servlet-name> + <servlet-class> + org.apache.shindig.social.sample.oauth.SampleOAuthServlet + </servlet-class> + </servlet> + + <!-- Serve OAuth 2 APIs --> + <servlet> + <servlet-name>OAuth2Servlet</servlet-name> + <servlet-class> + org.apache.shindig.social.core.oauth2.OAuth2Servlet + </servlet-class> + </servlet> + + <servlet> + <servlet-name>rpcSwf</servlet-name> + <servlet-class> + org.apache.shindig.gadgets.servlet.RpcSwfServlet + </servlet-class> + </servlet> + + <servlet-mapping> + <servlet-name>js</servlet-name> + <url-pattern>/gadgets/js/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>proxy</servlet-name> + <url-pattern>/gadgets/proxy/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>makeRequest</servlet-name> + <url-pattern>/gadgets/makeRequest</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>jsonRpcServlet</servlet-name> + <url-pattern>/rpc/*</url-pattern> + <url-pattern>/gadgets/api/rpc/*</url-pattern> + <url-pattern>/social/rpc/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>restapiServlet</servlet-name> + <url-pattern>/rest/*</url-pattern> + <url-pattern>/gadgets/api/rest/*</url-pattern> + <url-pattern>/social/rest/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>concat</servlet-name> + <url-pattern>/gadgets/concat</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>oauthCallback</servlet-name> + <url-pattern>/gadgets/oauthcallback</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>oauth2callback</servlet-name> + <url-pattern>/gadgets/oauth2callback</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>xml-to-html</servlet-name> + <url-pattern>/gadgets/ifr</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>accel</servlet-name> + <url-pattern>/gadgets/accel</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>metadata</servlet-name> + <url-pattern>/gadgets/metadata</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>sampleOAuth</servlet-name> + <url-pattern>/oauth/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>OAuth2Servlet</servlet-name> + <url-pattern>/oauth2/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>rpcSwf</servlet-name> + <url-pattern>/xpc*</url-pattern> + </servlet-mapping> +</web-app>
diff --git a/rave-custom-project-archetype/src/main/resources/archetype-resources/pom.xml b/rave-custom-project-archetype/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 0000000..cc7a555 --- /dev/null +++ b/rave-custom-project-archetype/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,173 @@ +<?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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>\${groupId}</groupId> + <artifactId>\${artifactId}</artifactId> + <name>\${projectName}</name> + <description>\${projectName}</description> + <packaging>pom</packaging> + <version>\${version}</version> + <properties> + <apache.rave.version>${project.version}</apache.rave.version> + <apache.wookie.version>${apache.wookie.version}</apache.wookie.version> + <com.h2database.version>${com.h2database.version}</com.h2database.version> + <org.springframework.version>${org.springframework.version}</org.springframework.version> + <javax.servlet.version>${javax.servlet.version}</javax.servlet.version> + <javax.mail.version>${javax.mail.version}</javax.mail.version> + <jsp-api.version>${jsp-api.version}</jsp-api.version> + <el-api.version>${el-api.version}</el-api.version> + <org.slf4j.version>${org.slf4j.version}</org.slf4j.version> + <log4j.version>${log4j.version}</log4j.version> + + <commons-lang.version>${commons-lang.version}</commons-lang.version> + <junit.version>${junit.version}</junit.version> + <easymock.version>${easymock.version}</easymock.version> + + <cargo.version>${cargo.version}</cargo.version> + <javaagent/> + + <!-- Force maven-filesync-plugin rewrite the Eclipse FileSync plugin configuration with + $mvn filesync:generate -Dmaven.filesync.override=true --> + <maven.filesync.override>${maven.filesync.override}</maven.filesync.override> + + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + + </properties> + + <repositories> + <repository> + <id>apache.snapshots</id> + <url>http://repository.apache.org/snapshots/</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <updatePolicy>daily</updatePolicy> + </snapshots> + </repository> + </repositories> + + <build> + <defaultGoal>install</defaultGoal> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.3.2</version> + <configuration> + <source>1.6</source> + <target>1.6</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>2.3</version> + </plugin> + <plugin> + <groupId>com.googlecode.mavenfilesync</groupId> + <artifactId>maven-filesync-plugin</artifactId> + <version>1.0.0</version> + <configuration> + <override>\${maven.filesync.override}</override> + </configuration> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </pluginManagement> + + <plugins> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId>com.github.searls</groupId> + <artifactId>jasmine-maven-plugin</artifactId> + <versionRange>[1.0.2-beta-2,)</versionRange> + <goals> + <goal>testResources</goal> + </goals> + </pluginExecutionFilter> + <action> + <execute /> + </action> + </pluginExecution> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.codehaus.mojo</groupId> + <artifactId>openjpa-maven-plugin</artifactId> + <versionRange>[1.2,)</versionRange> + <goals> + <goal>enhance</goal> + </goals> + </pluginExecutionFilter> + <action> + <execute /> + </action> + </pluginExecution> + <pluginExecution> + <pluginExecutionFilter> + <groupId>com.googlecode.mavenfilesync</groupId> + <artifactId>maven-filesync-plugin</artifactId> + <versionRange>[1.0.0,)</versionRange> + <goals> + <goal>generate</goal> + </goals> + </pluginExecutionFilter> + <action> + <execute /> + </action> + </pluginExecution> + <pluginExecution> + <pluginExecutionFilter> + <groupId>com.github.searls</groupId> + <artifactId>jasmine-maven-plugin</artifactId> + <versionRange>[1.0.2-beta-2,)</versionRange> + <goals> + <goal>resources</goal> + <goal>generateManualRunner</goal> + </goals> + </pluginExecutionFilter> + <action> + <execute /> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + + </plugins> + </build> +</project>
diff --git a/rave-custom-project-archetype/src/test/resources/projects/basic/archetype.properties b/rave-custom-project-archetype/src/test/resources/projects/basic/archetype.properties new file mode 100644 index 0000000..89ebc07 --- /dev/null +++ b/rave-custom-project-archetype/src/test/resources/projects/basic/archetype.properties
@@ -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. +# + +#Sat Dec 29 17:34:06 CET 2012 +package=it.pkg +version=0.1-SNAPSHOT +groupId=archetype.it +artifactId=basic +projectName=project
diff --git a/rave-custom-project-archetype/src/test/resources/projects/basic/goal.txt b/rave-custom-project-archetype/src/test/resources/projects/basic/goal.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/rave-custom-project-archetype/src/test/resources/projects/basic/goal.txt
diff --git a/rave-integration-tests/pom.xml b/rave-integration-tests/pom.xml index e5c42a5..586b396 100644 --- a/rave-integration-tests/pom.xml +++ b/rave-integration-tests/pom.xml
@@ -46,7 +46,6 @@ <meta.filter /> <!-- Cargo configuration properties --> - <cargo.version>1.3.1</cargo.version> <!-- if you want a remote debugging on a different a address override on command line with -Dcargo.debug.addres=xxxx --> <cargo.debug.address>8000</cargo.debug.address>
diff --git a/rave-portal/pom.xml b/rave-portal/pom.xml index 4e8f4b0..7156f7f 100644 --- a/rave-portal/pom.xml +++ b/rave-portal/pom.xml
@@ -33,7 +33,6 @@ <packaging>war</packaging> <properties> - <cargo.version>1.3.1</cargo.version> <!-- if you want a remote debugging on a different a address override on command line with -Dcargo.debug.addres=xxxx --> <cargo.debug.address>8000</cargo.debug.address>