Commits

Sebastian Sdorra committed 9bc47b7

added scm-core library

Comments (0)

Files changed (11)

   <name>scm</name>
 
   <modules>
+    <module>scm-core</module>
     <module>scm-webapp</module>
   </modules>
 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   </properties>
 
-</project>
-
+</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+      
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>scm</artifactId>
+    <groupId>sonia.scm</groupId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <groupId>sonia.scm</groupId>
+  <artifactId>scm-core</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>scm-core</name>
+
+</project>

scm-core/src/main/java/sonia/scm/Group.java

+/*
+ * 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.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+@XmlRootElement(name = "groups")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(propOrder = { "name", "members" })
+public class Group implements Serializable
+{
+
+  /** Field description */
+  private static final long serialVersionUID = 1752369869345245872L;
+
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  public Group() {}
+
+  /**
+   * 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;
+  }
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param name
+   * @param members
+   */
+  public Group(String name, String... members)
+  {
+    this.name = name;
+    this.members = new ArrayList<String>();
+
+    if (Util.isNotEmpty(members))
+    {
+      this.members.addAll(Arrays.asList(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;
+  }
+
+  //~--- set methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @param members
+   */
+  public void setMembers(List<String> members)
+  {
+    this.members = members;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param name
+   */
+  public void setName(String name)
+  {
+    this.name = name;
+  }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  @XmlElement(name = "members")
+  private List<String> members;
+
+  /** Field description */
+  private String name;
+}

scm-core/src/main/java/sonia/scm/Repository.java

+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+
+
+package sonia.scm;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+@XmlRootElement(name = "repositories")
+@XmlType(propOrder =
+{
+  "type", "name", "contact", "description"
+})
+public class Repository implements Serializable
+{
+
+  /** Field description */
+  private static final long serialVersionUID = 3486560714961909711L;
+
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  public Repository() {}
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param type
+   * @param name
+   */
+  public Repository(String type, String name)
+  {
+    this.type = type;
+    this.name = name;
+  }
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param type
+   * @param name
+   * @param contact
+   * @param description
+   */
+  public Repository(String type, String name, String contact,
+                    String description)
+  {
+    this.type = type;
+    this.name = name;
+    this.contact = contact;
+    this.description = description;
+  }
+
+  //~--- get methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public String getContact()
+  {
+    return contact;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public String getDescription()
+  {
+    return description;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public String getName()
+  {
+    return name;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public String getType()
+  {
+    return type;
+  }
+
+  //~--- set methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @param contact
+   */
+  public void setContact(String contact)
+  {
+    this.contact = contact;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param description
+   */
+  public void setDescription(String description)
+  {
+    this.description = description;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param name
+   */
+  public void setName(String name)
+  {
+    this.name = name;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param type
+   */
+  public void setType(String type)
+  {
+    this.type = type;
+  }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  private String contact;
+
+  /** Field description */
+  private String description;
+
+  /** Field description */
+  private String name;
+
+  /** Field description */
+  private String type;
+}

scm-core/src/main/java/sonia/scm/RepositoryType.java

+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+
+
+package sonia.scm;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class RepositoryType
+{
+
+  /**
+   * Constructs ...
+   *
+   */
+  public RepositoryType() {}
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param name
+   * @param displayName
+   */
+  public RepositoryType(String name, String displayName)
+  {
+    this.name = name;
+    this.displayName = displayName;
+  }
+
+  //~--- get methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public String getDisplayName()
+  {
+    return displayName;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public String getName()
+  {
+    return name;
+  }
+
+  //~--- set methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @param displayName
+   */
+  public void setDisplayName(String displayName)
+  {
+    this.displayName = displayName;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param name
+   */
+  public void setName(String name)
+  {
+    this.name = name;
+  }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  private String displayName;
+
+  /** Field description */
+  private String name;
+}

scm-core/src/main/java/sonia/scm/util/Util.java

+/*
+ * 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);
+  }
+}

scm-webapp/pom.xml

       <version>6.0</version>
       <scope>provided</scope>
     </dependency>
+
+    <dependency>
+      <groupId>sonia.scm</groupId>
+      <artifactId>scm-core</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
     
     <dependency>
       <groupId>com.sun.jersey</groupId>

scm-webapp/src/main/java/sonia/scm/Group.java

-/*
- * 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.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-/**
- *
- * @author Sebastian Sdorra
- */
-@XmlRootElement(name = "groups")
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(propOrder = { "name", "members" })
-public class Group implements Serializable
-{
-
-  /** Field description */
-  private static final long serialVersionUID = 1752369869345245872L;
-
-  //~--- constructors ---------------------------------------------------------
-
-  /**
-   * Constructs ...
-   *
-   */
-  public Group() {}
-
-  /**
-   * 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;
-  }
-
-  /**
-   * Constructs ...
-   *
-   *
-   * @param name
-   * @param members
-   */
-  public Group(String name, String... members)
-  {
-    this.name = name;
-    this.members = new ArrayList<String>();
-
-    if (Util.isNotEmpty(members))
-    {
-      this.members.addAll(Arrays.asList(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;
-  }
-
-  //~--- set methods ----------------------------------------------------------
-
-  /**
-   * Method description
-   *
-   *
-   * @param members
-   */
-  public void setMembers(List<String> members)
-  {
-    this.members = members;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @param name
-   */
-  public void setName(String name)
-  {
-    this.name = name;
-  }
-
-  //~--- fields ---------------------------------------------------------------
-
-  /** Field description */
-  @XmlElement(name = "members")
-  private List<String> members;
-
-  /** Field description */
-  private String name;
-}

scm-webapp/src/main/java/sonia/scm/Repository.java

-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-
-
-package sonia.scm;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.Serializable;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-/**
- *
- * @author Sebastian Sdorra
- */
-@XmlRootElement(name = "repositories")
-@XmlType(propOrder =
-{
-  "type", "name", "contact", "description"
-})
-public class Repository implements Serializable
-{
-
-  /** Field description */
-  private static final long serialVersionUID = 3486560714961909711L;
-
-  //~--- constructors ---------------------------------------------------------
-
-  /**
-   * Constructs ...
-   *
-   */
-  public Repository() {}
-
-  /**
-   * Constructs ...
-   *
-   *
-   * @param type
-   * @param name
-   */
-  public Repository(String type, String name)
-  {
-    this.type = type;
-    this.name = name;
-  }
-
-  /**
-   * Constructs ...
-   *
-   *
-   * @param type
-   * @param name
-   * @param contact
-   * @param description
-   */
-  public Repository(String type, String name, String contact,
-                    String description)
-  {
-    this.type = type;
-    this.name = name;
-    this.contact = contact;
-    this.description = description;
-  }
-
-  //~--- get methods ----------------------------------------------------------
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  public String getContact()
-  {
-    return contact;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  public String getDescription()
-  {
-    return description;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  public String getName()
-  {
-    return name;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  public String getType()
-  {
-    return type;
-  }
-
-  //~--- set methods ----------------------------------------------------------
-
-  /**
-   * Method description
-   *
-   *
-   * @param contact
-   */
-  public void setContact(String contact)
-  {
-    this.contact = contact;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @param description
-   */
-  public void setDescription(String description)
-  {
-    this.description = description;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @param name
-   */
-  public void setName(String name)
-  {
-    this.name = name;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @param type
-   */
-  public void setType(String type)
-  {
-    this.type = type;
-  }
-
-  //~--- fields ---------------------------------------------------------------
-
-  /** Field description */
-  private String contact;
-
-  /** Field description */
-  private String description;
-
-  /** Field description */
-  private String name;
-
-  /** Field description */
-  private String type;
-}

scm-webapp/src/main/java/sonia/scm/RepositoryType.java

-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-
-
-package sonia.scm;
-
-/**
- *
- * @author Sebastian Sdorra
- */
-public class RepositoryType
-{
-
-  /**
-   * Constructs ...
-   *
-   */
-  public RepositoryType() {}
-
-  /**
-   * Constructs ...
-   *
-   *
-   * @param name
-   * @param displayName
-   */
-  public RepositoryType(String name, String displayName)
-  {
-    this.name = name;
-    this.displayName = displayName;
-  }
-
-  //~--- get methods ----------------------------------------------------------
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  public String getDisplayName()
-  {
-    return displayName;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  public String getName()
-  {
-    return name;
-  }
-
-  //~--- set methods ----------------------------------------------------------
-
-  /**
-   * Method description
-   *
-   *
-   * @param displayName
-   */
-  public void setDisplayName(String displayName)
-  {
-    this.displayName = displayName;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @param name
-   */
-  public void setName(String name)
-  {
-    this.name = name;
-  }
-
-  //~--- fields ---------------------------------------------------------------
-
-  /** Field description */
-  private String displayName;
-
-  /** Field description */
-  private String name;
-}

scm-webapp/src/main/java/sonia/scm/util/Util.java

-/*
- * 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);
-  }
-}