[jboss-svn-commits] JBL Code SVN: r20401 - in labs/jbosslabs/labs-3.0-build: integration/cs-nukes-login and 18 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jun 10 09:08:32 EDT 2008
Author: szimano
Date: 2008-06-10 09:08:31 -0400 (Tue, 10 Jun 2008)
New Revision: 20401
Added:
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/pom.xml
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/resources/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/resources/spring.xml
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/jboss/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/jboss/labs/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/jboss/labs/clearspace/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/jboss/labs/clearspace/LabsAuthenticationProvider.java
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/jboss/labs/clearspace/LabsUser.java
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/test/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/test/java/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/test/java/org/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/test/java/org/jboss/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/test/java/org/jboss/labs/
labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/test/java/org/jboss/labs/AppTest.java
Modified:
labs/jbosslabs/labs-3.0-build/integration/pom.xml
labs/jbosslabs/labs-3.0-build/integration/seam-guice/pom.xml
labs/jbosslabs/labs-3.0-build/labs-archetypes/labs-service-ear-archetype/src/main/resources/archetype-resources/ejb/pom.xml
labs/jbosslabs/labs-3.0-build/labs-archetypes/labs-service-ear-archetype/src/main/resources/archetype-resources/view/pom.xml
labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsClearspaceMojo.java
labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsClearspaceSetupPlugin.java
labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsDeployMojo.java
labs/jbosslabs/labs-3.0-build/services/foo-service/pom.xml
Log:
clearspace login integration with nukes, modified mojos, labs repo dependecies
Property changes on: labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login
___________________________________________________________________
Name: svn:ignore
+ target
.classpath
.project
.settings
.iml
Added: labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/pom.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/pom.xml (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/pom.xml 2008-06-10 13:08:31 UTC (rev 20401)
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<project>
+ <parent>
+ <artifactId>integration</artifactId>
+ <groupId>org.jboss.labs</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.labs</groupId>
+ <artifactId>cs-nukes-login</artifactId>
+ <name>Clearspace-Nukes login integration</name>
+ <version>1.0-SNAPSHOT</version>
+ <url>http://maven.apache.org</url>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.jivesoftware</groupId>
+ <artifactId>clearspace-community</artifactId>
+ <version>2.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.acegisecurity</groupId>
+ <artifactId>acegi-security</artifactId>
+ <version>1.0.6</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tangosol</groupId>
+ <artifactId>tangosol</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>sun-jaxws-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.geronimo</groupId>
+ <artifactId>geronimo-ws-metadata</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus</groupId>
+ <artifactId>jra</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.labs</groupId>
+ <artifactId>maven-labs-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install</id>
+ <phase>install</phase>
+ <goals>
+ <goal>cs-setup</goal>
+ <goal>cs-deploy</goal>
+ </goals>
+ <configuration>
+ <!-- LabsClearspaceSetupMojo configuration -->
+ <csSetupable>true</csSetupable>
+ <csDeploy>true</csDeploy>
+ <destinationFolder>JIVE_HOME/etc</destinationFolder>
+ <resourcesFolder>resources</resourcesFolder>
+ <fileFinalName>ROOT.war/WEB-INF/lib/${project.build.finalName}.${project.packaging}</fileFinalName>
+ <labsDeploy>false</labsDeploy>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/resources/spring.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/resources/spring.xml (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/resources/spring.xml 2008-06-10 13:08:31 UTC (rev 20401)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ 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-2.0.xsd">
+<bean id="labsAuthProvider" class="org.jboss.labs.clearspace.LabsAuthenticationProvider">
+ <property name="userService" ref="userServiceImpl" />
+ <property name="userManager" ref="userManagerImpl" />
+ <property name="userDetailsService" ref="jiveUserDetailsService"/>
+ <property name="jiveAuthProvider" ref="authenticationProvider" />
+</bean>
+
+<bean id="authenticationManager"
+ class="org.acegisecurity.providers.ProviderManager">
+ <property name="providers">
+ <list>
+ <ref bean="labsAuthProvider"/>
+ <ref bean="daoAuthenticationProvider" />
+ <ref bean="rememberMeAuthenticationProvider"/>
+ </list>
+ </property>
+</bean>
+</beans>
Added: labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/jboss/labs/clearspace/LabsAuthenticationProvider.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/jboss/labs/clearspace/LabsAuthenticationProvider.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/jboss/labs/clearspace/LabsAuthenticationProvider.java 2008-06-10 13:08:31 UTC (rev 20401)
@@ -0,0 +1,245 @@
+package org.jboss.labs.clearspace;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.concurrent.Callable;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.acegisecurity.Authentication;
+import org.acegisecurity.BadCredentialsException;
+import org.acegisecurity.GrantedAuthority;
+import org.acegisecurity.providers.AuthenticationProvider;
+import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
+import org.acegisecurity.userdetails.UserDetails;
+import org.acegisecurity.userdetails.UserDetailsService;
+
+import com.jivesoftware.base.UserManager;
+import com.jivesoftware.base.UserNotFoundException;
+import com.jivesoftware.base.UserTemplate;
+import com.jivesoftware.community.aaa.JiveUserDetails;
+import com.jivesoftware.community.aaa.authz.SystemExecutor;
+import com.jivesoftware.community.webservices.UserService;
+
+public class LabsAuthenticationProvider implements AuthenticationProvider {
+
+ private UserService userService;
+
+ private UserManager userManager;
+
+ private UserDetailsService userDetailsService;
+
+ protected com.jivesoftware.base.aaa.AuthenticationProvider jiveAuthProvider;
+
+ private final static Logger log = Logger
+ .getLogger(LabsAuthenticationProvider.class.getName());
+
+ public LabsAuthenticationProvider() {
+
+ }
+
+ public Authentication authenticate(Authentication authentication)
+ throws org.acegisecurity.AuthenticationException {
+
+ UsernamePasswordAuthenticationToken auth = (UsernamePasswordAuthenticationToken) authentication;
+ String username = String.valueOf(auth.getPrincipal());
+ String password = String.valueOf(auth.getCredentials());
+
+ if (!username.equals("admin")) {
+
+ String passHashed = toHexString(md5(password));
+
+ Connection c = null;
+
+ try {
+ c = getConnection();
+ ResultSet rs = c.createStatement().executeQuery(
+ "SELECT * FROM nuke_users WHERE pn_uname='" + username
+ + "';");
+ if (rs.next()) {
+ LabsUser nukeUser = new LabsUser(rs);
+
+ // swap this for a JiveUserDetails
+ UserDetails ud = null;
+
+ try {
+ ud = userDetailsService.loadUserByUsername(username);
+ } catch (Exception unfe) {
+ // this is ok, if we haven't seen a user before, we
+ // won't necessarily be
+ // able to load them
+ }
+
+ if (null == ud) {
+ log.info("Creating new application user for user '"
+ + username + "'.");
+ try {
+ UserTemplate ut = new UserTemplate(username);
+ ut.setFederated(true);
+
+ ut = mapDetails(ut, nukeUser);
+ userManager.createApplicationUser(ut);
+
+ // try again to load the user from the details
+ // service, this time it should work
+ ud = userDetailsService
+ .loadUserByUsername(username);
+ } catch (Exception ex) {
+ log.log(Level.WARNING,
+ "Failed to create application user for '"
+ + username + "'.", ex);
+ }
+ } else {
+ // bring user information current with LDAP values
+ try {
+ log
+ .info("Updating user properties from Nukes attribute for authenticated user.");
+ UserTemplate ut = new UserTemplate(
+ ((JiveUserDetails) ud).getUser());
+ // CS-3223 - the user should always be marked as
+ // federated
+ ut.setFederated(true);
+ // final UserTemplate toUpdate =
+ // mapAttributesToTemplate(attrs, ut);
+ final UserTemplate toUpdate = mapDetails(ut,
+ nukeUser);
+ toUpdate.setID(ut.getID());
+
+ toUpdate.setLastLoggedIn(new Date());
+ SystemExecutor exec = new SystemExecutor(
+ jiveAuthProvider);
+ exec.executeCallable(new Callable() {
+ public Object call() throws Exception {
+ userManager.updateUser(toUpdate);
+ return null;
+ }
+ });
+ } catch (Exception ex) {
+ log
+ .log(
+ Level.INFO,
+ "Failed to update user data from Nukes attributes.",
+ ex);
+ }
+ }
+
+ if (!nukeUser.getPasswordHash().equals(passHashed)) {
+ throw new BadCredentialsException("Username:"
+ + username + " was not authenticated");
+ } else {
+ UsernamePasswordAuthenticationToken newAuthentication = new UsernamePasswordAuthenticationToken(
+ ud, authentication.getCredentials(), ud
+ .getAuthorities());
+ newAuthentication.setDetails(ud);
+ return newAuthentication;
+ }
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ try {
+ c.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ return null;
+
+ } else {
+ return null;
+ }
+ }
+
+ private UserTemplate mapDetails(UserTemplate ut, LabsUser nukeUser) {
+ ut.setEmail(nukeUser.getEmail());
+ ut.setName(nukeUser.getName());
+ ut.setPasswordHash(nukeUser.getPasswordHash());
+
+ return ut;
+ }
+
+ public boolean supports(Class authentication) {
+ return authentication == UsernamePasswordAuthenticationToken.class;
+ }
+
+ private Connection getConnection() throws Exception {
+ String userName = "portal";
+ String pass = "portalpassword";
+ String url = "jdbc:mysql://localhost:3306/nukes3";
+ Class.forName("com.mysql.jdbc.Driver").newInstance();
+ return DriverManager.getConnection(url, userName, pass);
+ }
+
+ /**
+ * Returns a string in the hexadecimal format.
+ *
+ * @param bytes
+ * the converted bytes
+ * @return the hexadecimal string representing the bytes data
+ * @throws IllegalArgumentException
+ * if the byte array is null
+ */
+ public static String toHexString(byte[] bytes) {
+ if (bytes == null) {
+ throw new IllegalArgumentException("byte array must not be null");
+ }
+ StringBuffer hex = new StringBuffer(bytes.length * 2);
+ for (int i = 0; i < bytes.length; i++) {
+ hex.append(Character.forDigit((bytes[i] & 0XF0) >> 4, 16));
+ hex.append(Character.forDigit((bytes[i] & 0X0F), 16));
+ }
+ return hex.toString();
+ }
+
+ /**
+ * Computes an md5 hash of a string.
+ *
+ * @param text
+ * the hashed string
+ * @return the string hash
+ * @throws NullPointerException
+ * if text is null
+ */
+ public static byte[] md5(String text) {
+ // arguments check
+ if (text == null) {
+ throw new NullPointerException("null text");
+ }
+
+ try {
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ md.update(text.getBytes());
+ return md.digest();
+ } catch (NoSuchAlgorithmException e) {
+ System.err.println("Cannot find MD5 algorithm" + e);
+ throw new RuntimeException("Cannot find MD5 algorithm");
+ }
+ }
+
+ public void setUserService(UserService userService) {
+ // this.userService = userService;
+
+ }
+
+ public void setUserManager(UserManager userManager) {
+ this.userManager = userManager;
+ }
+
+ public void setUserDetailsService(UserDetailsService userDetailsService) {
+ this.userDetailsService = userDetailsService;
+ }
+
+ public void setJiveAuthProvider(
+ com.jivesoftware.base.aaa.AuthenticationProvider jiveAuthProvider) {
+ this.jiveAuthProvider = jiveAuthProvider;
+ }
+
+}
Added: labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/jboss/labs/clearspace/LabsUser.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/jboss/labs/clearspace/LabsUser.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/main/java/org/jboss/labs/clearspace/LabsUser.java 2008-06-10 13:08:31 UTC (rev 20401)
@@ -0,0 +1,187 @@
+package org.jboss.labs.clearspace;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.jivesoftware.base.AuthToken;
+import com.jivesoftware.base.UnauthorizedException;
+import com.jivesoftware.base.User;
+import com.jivesoftware.community.Permissions;
+import com.jivesoftware.community.cache.Cacheable;
+import com.jivesoftware.community.webservices.WSUser;
+
+public class LabsUser implements User, Cacheable {
+
+ private final static Permissions perms = new Permissions(Permissions.NONE);;
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private Date creationDate;
+ private String email;
+ private long uID;
+ private Date lastLoggedIn;
+ private Date modifDate;
+ private String name;
+ private String passHash;
+ private String username;
+
+ public LabsUser() {
+
+ }
+
+ public LabsUser(ResultSet rs) throws SQLException {
+ creationDate = rs.getDate("pn_user_regdate");
+ email = rs.getString("pn_email");
+ //uID = rs.getLong("pn_uid");
+ lastLoggedIn = rs.getDate("pn_last_visit");
+ modifDate = creationDate;
+ username = rs.getString("pn_uname");
+ name = rs.getString("pn_name");
+ passHash = rs.getString("pn_pass");
+ }
+
+ public LabsUser(String username) {
+ this.username = username;
+ }
+
+ public Date getCreationDate() {
+ return creationDate;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public long getID() {
+ return uID;
+ }
+
+ public Date getLastLoggedIn() {
+ return lastLoggedIn;
+ }
+
+ public Date getModificationDate() {
+ return modifDate;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getPassword() throws UnauthorizedException {
+ return null;
+ }
+
+ public String getPasswordHash() throws UnauthorizedException {
+ return passHash;
+ }
+
+ public Permissions getPermissions(AuthToken token) {
+ // TODO Auto-generated method stub
+ return perms;
+ }
+
+ public Map<String, String> getProperties() {
+ // TODO Auto-generated method stub
+ return new HashMap<String, String>();
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public boolean isAuthorized(long permissionType) {
+ return true;
+ }
+
+ public boolean isEmailVisible() {
+ return false;
+ }
+
+ public boolean isEnabled() {
+ return true;
+ }
+
+ public boolean isExternal() {
+ return false;
+ }
+
+ public boolean isFederated() {
+ return true;
+ }
+
+ public boolean isGetPasswordHashSupported() {
+ return true;
+ }
+
+ public boolean isNameVisible() {
+ return true;
+ }
+
+ public boolean isPropertyEditSupported() {
+ return false;
+ }
+
+ public boolean isSetEmailSupported() {
+ return false;
+ }
+
+ public boolean isSetEmailVisibleSupported() {
+ return false;
+ }
+
+ public boolean isSetNameSupported() {
+ return false;
+ }
+
+ public boolean isSetNameVisibleSupported() {
+ return false;
+ }
+
+ public boolean isSetPasswordHashSupported() {
+ return false;
+ }
+
+ public boolean isSetPasswordSupported() {
+ return false;
+ }
+
+ public boolean isSetUsernameSupported() {
+ return false;
+ }
+
+ public int getObjectType() {
+ //TODO wth is it ?
+ return 1;
+ }
+
+ public int getCachedSize() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public WSUser getWSUser() {
+ WSUser u = new WSUser();
+ u.setCreationDate(getCreationDate());
+ u.setEmail(getEmail());
+ u.setEmailVisible(false);
+ u.setEnabled(true);
+ u.setID(getID());
+ u.setModificationDate(getModificationDate());
+ u.setName(getName());
+ u.setNameVisible(true);
+ u.setPassword(getPasswordHash());
+ u.setUsername(getUsername());
+
+ return u;
+ }
+
+ public void setID(long id) {
+ this.uID = id;
+ }
+}
Added: labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/test/java/org/jboss/labs/AppTest.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/test/java/org/jboss/labs/AppTest.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nukes-login/src/test/java/org/jboss/labs/AppTest.java 2008-06-10 13:08:31 UTC (rev 20401)
@@ -0,0 +1,38 @@
+package org.jboss.labs;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ assertTrue( true );
+ }
+}
Modified: labs/jbosslabs/labs-3.0-build/integration/pom.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/pom.xml 2008-06-10 12:25:03 UTC (rev 20400)
+++ labs/jbosslabs/labs-3.0-build/integration/pom.xml 2008-06-10 13:08:31 UTC (rev 20401)
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<project>
<parent>
<artifactId>labs</artifactId>
@@ -12,10 +12,8 @@
<name>integration</name>
<version>1.0-SNAPSHOT</version>
<url>http://maven.apache.org</url>
- <build>
- <finalName>integration</finalName>
- </build>
<modules>
<module>seam-guice</module>
+ <module>cs-nukes-login</module>
</modules>
</project>
Modified: labs/jbosslabs/labs-3.0-build/integration/seam-guice/pom.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/seam-guice/pom.xml 2008-06-10 12:25:03 UTC (rev 20400)
+++ labs/jbosslabs/labs-3.0-build/integration/seam-guice/pom.xml 2008-06-10 13:08:31 UTC (rev 20401)
@@ -28,4 +28,4 @@
</exclusions>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
Modified: labs/jbosslabs/labs-3.0-build/labs-archetypes/labs-service-ear-archetype/src/main/resources/archetype-resources/ejb/pom.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/labs-archetypes/labs-service-ear-archetype/src/main/resources/archetype-resources/ejb/pom.xml 2008-06-10 12:25:03 UTC (rev 20400)
+++ labs/jbosslabs/labs-3.0-build/labs-archetypes/labs-service-ear-archetype/src/main/resources/archetype-resources/ejb/pom.xml 2008-06-10 13:08:31 UTC (rev 20401)
@@ -41,7 +41,7 @@
<groupId>org.jboss.labs</groupId>
<artifactId>maven-labs-plugin</artifactId>
<configuration>
- <execute>false</execute>
+ <labsDeploy>false</labsDeploy>
</configuration>
</plugin>
</plugins>
Modified: labs/jbosslabs/labs-3.0-build/labs-archetypes/labs-service-ear-archetype/src/main/resources/archetype-resources/view/pom.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/labs-archetypes/labs-service-ear-archetype/src/main/resources/archetype-resources/view/pom.xml 2008-06-10 12:25:03 UTC (rev 20400)
+++ labs/jbosslabs/labs-3.0-build/labs-archetypes/labs-service-ear-archetype/src/main/resources/archetype-resources/view/pom.xml 2008-06-10 13:08:31 UTC (rev 20401)
@@ -20,7 +20,7 @@
<groupId>org.jboss.labs</groupId>
<artifactId>maven-labs-plugin</artifactId>
<configuration>
- <execute>false</execute>
+ <labsDeploy>false</labsDeploy>
</configuration>
</plugin>
</plugins>
Modified: labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsClearspaceMojo.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsClearspaceMojo.java 2008-06-10 12:25:03 UTC (rev 20400)
+++ labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsClearspaceMojo.java 2008-06-10 13:08:31 UTC (rev 20401)
@@ -36,8 +36,11 @@
{
private static final String CLEARSPACE_HOME="CLEARSPACE_HOME";
+ private static final String JIVE_HOME="JIVE_HOME";
protected File clearspaceHome;
+
+ protected File jiveHome;
public void execute() throws MojoExecutionException,
MojoFailureException
@@ -60,10 +63,26 @@
} else
{
throw new MojoExecutionException(
- "jbossDirectory property is not set. Please set either $CLEARSPACE_HOME or the property");
+ "clearspaceDirectory property is not set. Please set either $CLEARSPACE_HOME or the property");
}
}
+
+ if (jiveHome == null)
+ {
+ if (System.getProperty(JIVE_HOME) != null)
+ {
+ jiveHome = new File(System.getProperty(JIVE_HOME));
+ } else if (System.getenv(JIVE_HOME) != null)
+ {
+ jiveHome = new File(System.getenv(JIVE_HOME));
+ } else
+ {
+ throw new MojoExecutionException(
+ "jiveHomeDirectory property is not set. Please set either $JIVE_HOME or the property");
+ }
+ }
+
// execute plugin
executeLabs();
}
Modified: labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsClearspaceSetupPlugin.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsClearspaceSetupPlugin.java 2008-06-10 12:25:03 UTC (rev 20400)
+++ labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsClearspaceSetupPlugin.java 2008-06-10 13:08:31 UTC (rev 20401)
@@ -32,96 +32,102 @@
* @author <a href="ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
* @goal cs-setup
* @phase process-resources
- *
+ *
*/
-public class LabsClearspaceSetupPlugin extends LabsClearspaceMojo
-{
+public class LabsClearspaceSetupPlugin extends LabsClearspaceMojo {
- private static final String HOME = "HOME";
+ private static final String HOME = "HOME";
- private static final String DEPLOY = "DEPLOY";
+ private static final String DEPLOY = "DEPLOY";
- private static final String CONF = "CONF";
+ private static final String CONF = "CONF";
- /**
- * Set to true if you want to use this project in your setup phase
- *
- * @parameter default-value="false"
- * @required
- */
- private boolean csSetupable;
+ private static final String JIVE_HOME = "JIVE_HOME";
- /**
- * Folder with resources to be copied
- *
- * @parameter expression="${project.basedir}/resources"
- * @required
- */
- private File resourcesFolder;
+ /**
+ * Set to true if you want to use this project in your setup phase
+ *
+ * @parameter default-value="false"
+ * @required
+ */
+ private boolean csSetupable;
- /**
- * Target folder where resources will be copied. Use HOME for clearspaceHome,
- * DEPLOY for ${clearspaceHome}/webapps, CONF for
- * ${clearspaceHome}/conf or anything else to copy to
- * ${clearspaceHome}/${toFolder}
- *
- * @parameter default-value="DEPLOY"
- * @required
- */
- private String destinationFolder;
+ /**
+ * Folder with resources to be copied
+ *
+ * @parameter expression="${project.basedir}/resources"
+ * @required
+ */
+ private File resourcesFolder;
- /**
- * Regular expression that describes list of files to include. Please note
- * that includes has a higher priority then excludes.
- *
- * @parameter
- */
- private String includes;
+ /**
+ * Target folder where resources will be copied. Use HOME for
+ * clearspaceHome, DEPLOY for ${clearspaceHome}/webapps, CONF for
+ * ${clearspaceHome}/conf or anything else to copy to
+ * ${clearspaceHome}/${toFolder}
+ *
+ * @parameter default-value="DEPLOY"
+ * @required
+ */
+ private String destinationFolder;
- /**
- * Regular expression that describes list of files to exclude. Please note
- * that includes has a higher priority then excludes.
- *
- * @parameter
- */
- private String excludes;
+ /**
+ * Regular expression that describes list of files to include. Please note
+ * that includes has a higher priority then excludes.
+ *
+ * @parameter
+ */
+ private String includes;
- protected void executeLabs() throws MojoExecutionException,
- MojoFailureException {
- if (csSetupable) {
- String copyTo;
+ /**
+ * Regular expression that describes list of files to exclude. Please note
+ * that includes has a higher priority then excludes.
+ *
+ * @parameter
+ */
+ private String excludes;
- if (destinationFolder.startsWith(HOME)) {
- copyTo = clearspaceHome.getAbsolutePath()
- + destinationFolder.substring(HOME.length());
- } else if (destinationFolder.startsWith(DEPLOY)) {
- copyTo = clearspaceHome.getAbsolutePath() + "/webapps"
- + destinationFolder.substring(DEPLOY.length());
- } else if (destinationFolder.startsWith(CONF)) {
- copyTo = clearspaceHome.getAbsolutePath() + destinationFolder.substring(CONF.length());
- } else {
- copyTo = clearspaceHome.getAbsolutePath() + "/" + destinationFolder;
- }
+ protected void executeLabs() throws MojoExecutionException,
+ MojoFailureException {
+ if (csSetupable) {
+ String copyTo;
- File copyToDir = new File(copyTo);
+ if (destinationFolder.startsWith(HOME)) {
+ copyTo = clearspaceHome.getAbsolutePath()
+ + destinationFolder.substring(HOME.length());
+ } else if (destinationFolder.startsWith(DEPLOY)) {
+ copyTo = clearspaceHome.getAbsolutePath() + "/webapps"
+ + destinationFolder.substring(DEPLOY.length());
+ } else if (destinationFolder.startsWith(CONF)) {
+ copyTo = clearspaceHome.getAbsolutePath()
+ + destinationFolder.substring(CONF.length());
+ } else if (destinationFolder.startsWith("JIVE_HOME")) {
+ copyTo = jiveHome.getAbsolutePath()
+ + destinationFolder.substring(JIVE_HOME.length());
+ } else {
+ copyTo = clearspaceHome.getAbsolutePath() + "/"
+ + destinationFolder;
+ }
- // check if it exists and is a directory
- if (copyToDir.exists() && !copyToDir.isDirectory()) {
- throw new MojoExecutionException(copyTo + " is not a directory");
- }
- // if it doesn't exist - try to create dirs
- else if (!copyToDir.exists() && !copyToDir.mkdirs()) {
- throw new MojoExecutionException(
- "Unable to create directory structure for " + copyTo);
- }
+ File copyToDir = new File(copyTo);
- getLog().info(
- "Seting Up " + resourcesFolder.getAbsolutePath() + " to "
- + copyTo);
+ // check if it exists and is a directory
+ if (copyToDir.exists() && !copyToDir.isDirectory()) {
+ throw new MojoExecutionException(copyTo + " is not a directory");
+ }
+ // if it doesn't exist - try to create dirs
+ else if (!copyToDir.exists() && !copyToDir.mkdirs()) {
+ throw new MojoExecutionException(
+ "Unable to create directory structure for " + copyTo);
+ }
- copyDir(resourcesFolder, copyToDir, new LabsFilenameFilter(includes,
- excludes));
- }
- }
+ getLog().info(
+ "Seting Up " + resourcesFolder.getAbsolutePath() + " to "
+ + copyTo);
+ copyDir(resourcesFolder, copyToDir, new LabsFilenameFilter(
+ includes, excludes));
+ }
+ }
+
}
Modified: labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsDeployMojo.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsDeployMojo.java 2008-06-10 12:25:03 UTC (rev 20400)
+++ labs/jbosslabs/labs-3.0-build/maven-labs-plugin/src/main/java/org/jboss/labs/plugin/LabsDeployMojo.java 2008-06-10 13:08:31 UTC (rev 20401)
@@ -66,7 +66,7 @@
* @parameter default-value="true"
* @required
*/
- private boolean execute;
+ private boolean labsDeploy;
/**
* Property used to determine if we're inside allowed packaging - if yes, it
@@ -90,7 +90,7 @@
MojoFailureException {
String[] packs = allowedPackagings.split(",");
- if (checkPackaging(packs) && execute) {
+ if (checkPackaging(packs) && labsDeploy) {
if (!fileToDeploy.exists() || fileToDeploy.isDirectory()) {
throw new MojoExecutionException("File "
+ fileToDeploy.getAbsolutePath()
Modified: labs/jbosslabs/labs-3.0-build/services/foo-service/pom.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/services/foo-service/pom.xml 2008-06-10 12:25:03 UTC (rev 20400)
+++ labs/jbosslabs/labs-3.0-build/services/foo-service/pom.xml 2008-06-10 13:08:31 UTC (rev 20401)
@@ -42,12 +42,6 @@
<version>4.2.0.GA</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>com.jivesoftware</groupId>
- <artifactId>clearspace-community</artifactId>
- <version>2.0.1</version>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
<plugins>
More information about the jboss-svn-commits
mailing list