initial import of scm-webapp

This commit is contained in:
Sebastian Sdorra
2010-09-03 14:28:22 +02:00
parent 1762010eee
commit 43981fd8fe
5 changed files with 397 additions and 0 deletions

115
scm-webapp/pom.xml Normal file
View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>sonia.scm</groupId>
<artifactId>scm-webapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>scm-webapp Java EE 6 Webapp</name>
<repositories>
<repository>
<id>java.net2</id>
<name>Repository hosting the jee6 artifacts</name>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
<finalName>scm-webapp</finalName>
</build>
<profiles>
<profile>
<id>endorsed</id>
<activation>
<property>
<name>sun.boot.class.path</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<compilerArguments>
<bootclasspath>${settings.localRepository}/javax/javaee-endorsed-api/6.0/javaee-endorsed-api-6.0.jar${path.separator}${sun.boot.class.path}</bootclasspath>
</compilerArguments>
</configuration>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@@ -0,0 +1,158 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sonia.scm;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.util.Util;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
*
* @author Sebastian Sdorra
*/
public class Group implements Serializable
{
/** Field description */
private static final long serialVersionUID = 1752369869345245872L;
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
*
*
* @param name
*/
public Group(String name)
{
this.name = name;
this.members = new ArrayList<String>();
}
/**
* Constructs ...
*
*
* @param name
* @param members
*/
public Group(String name, List<String> members)
{
this.name = name;
this.members = members;
}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @param member
*
* @return
*/
public boolean add(String member)
{
return members.add(member);
}
/**
* Method description
*
*/
public void clear()
{
members.clear();
}
/**
* Method description
*
*
* @param member
*
* @return
*/
public boolean remove(String member)
{
return members.remove(member);
}
/**
* Method description
*
*
* @return
*/
@Override
public String toString()
{
StringBuilder msg = new StringBuilder();
msg.append(name).append(" [");
if (Util.isNotEmpty(members))
{
Iterator<String> it = members.iterator();
while (it.hasNext())
{
msg.append(it.next());
if (it.hasNext())
{
msg.append(",");
}
}
}
return msg.append("]").toString();
}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @return
*/
public List<String> getMembers()
{
return members;
}
/**
* Method description
*
*
* @return
*/
public String getName()
{
return name;
}
//~--- fields ---------------------------------------------------------------
/** Field description */
private List<String> members;
/** Field description */
private String name;
}

View File

@@ -0,0 +1,98 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sonia.scm.util;
//~--- JDK imports ------------------------------------------------------------
import java.util.Collection;
/**
*
* @author Sebastian Sdorra
*/
public class Util
{
/**
* Method description
*
*
* @param value
*
* @return
*/
public static boolean isEmpty(String value)
{
return (value == null) || (value.trim().length() == 0);
}
/**
* Method description
*
*
* @param collection
*
* @return
*/
public static boolean isEmpty(Collection<?> collection)
{
return (collection == null) || collection.isEmpty();
}
/**
* Method description
*
*
* @param array
*
* @return
*/
public static boolean isEmpty(Object[] array)
{
return (array == null) || (array.length == 0);
}
/**
* Method description
*
*
* @param value
*
* @return
*/
public static boolean isNotEmpty(String value)
{
return (value != null) && (value.trim().length() > 0);
}
/**
* Method description
*
*
* @param collection
*
* @return
*/
public static boolean isNotEmpty(Collection<?> collection)
{
return (collection != null) &&!collection.isEmpty();
}
/**
* Method description
*
*
* @param array
*
* @return
*/
public static boolean isNotEmpty(Object[] array)
{
return (array != null) && (array.length > 0);
}
}

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>

View File

@@ -0,0 +1,13 @@
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>