Kevin Poalses avatar Kevin Poalses committed 1e50019

QUALIMP: Preparing for next release

Comments (0)

Files changed (21)

     compile group: 'cglib', name: 'cglib', version: '2.2.2' // 2.2.3 not on central yet
 
     // Persistence    
-    compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '1.2.0.RELEASE+'
+    compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '1.2.0.RELEASE'
     compile group: 'org.hibernate', name: 'hibernate-entitymanager', version: '4.1.9.Final'
 
     // Testing
     }
 }
 
+// Build a JAR of our sources
+task sourcesJar(type: Jar, dependsOn: classes) {
+    classifier = 'sources'
+    from sourceSets.main.allSource
+}
+
+// Build a JAR of our JavaDoc documentation
+task javadocJar(type: Jar, dependsOn: javadoc) {
+    classifier = 'javadoc'
+    from javadoc.destinationDir
+}
+
+// Include our custom JARs as artifacts
+artifacts {
+    archives sourcesJar
+    archives javadocJar
+}
+
+// Maven repositories
+if (project.hasProperty("artifactory_contextUrl")) {
+    // Use Artifactory repository as primary maven repo
+    repositories {
+        maven { url "${artifactory_contextUrl}/libs-snapshot" }
+        maven { url "${artifactory_contextUrl}/libs-release" }
+        maven { url "${artifactory_contextUrl}/repo" }
+    }
+} else {
+    // Fall back to maven repositories
+    repositories {
+        mavenLocal()
+        maven { url "http://repo.springsource.org/release" }
+        mavenCentral()
+    }
+}
+
 // Ensure we have Artifactory support
 buildscript {
     repositories {

src/main/java/net/poalsoft/common/lifecycle/AbstractActiveObject.java

 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.concurrent.ThreadSafe;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 /**
  * Abstract base class for active objects.
  *
+ * <p>Derived classes <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
+ *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public abstract class AbstractActiveObject implements ActiveObject {
 
     public AbstractActiveObject() {

src/main/java/net/poalsoft/common/lifecycle/ActiveObject.java

 
 package net.poalsoft.common.lifecycle;
 
+import javax.annotation.concurrent.ThreadSafe;
+
 /**
  * An object which can be started up and shut down.
  *
+ * <p>Implementations <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
+ *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public interface ActiveObject {
 
     /**

src/main/java/net/poalsoft/common/persistence/HibernateUtils.java

 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.concurrent.ThreadSafe;
 import java.lang.reflect.Field;
 import java.util.*;
 
  *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public final class HibernateUtils {
 
     private HibernateUtils() {

src/main/java/net/poalsoft/common/pool/Pool.java

 
 package net.poalsoft.common.pool;
 
+import javax.annotation.concurrent.ThreadSafe;
+
 /**
  * A simple object pool.
  *
+ * <p>Implementations <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
+ *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public interface Pool<KeyType, ValueType> {
 
     ValueType grab(KeyType key,

src/main/java/net/poalsoft/common/pool/internal/SimplePoolImpl.java

 import com.google.common.collect.Multimap;
 import net.poalsoft.common.pool.Pool;
 
+import javax.annotation.concurrent.ThreadSafe;
 import java.util.Collection;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
  *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public class SimplePoolImpl<KeyType, ValueType> implements Pool<KeyType, ValueType> {
 
     public SimplePoolImpl() {

src/main/java/net/poalsoft/common/util/AbstractVisitor.java

 
 /**
  * An abstract visitor.
+ *
  * <p/>
  * <p>Subclasses should implement visit methods for specific types they wish to visit,
  * the abstract visitor will call those via reflection</p>
  *
+ * <p>Subclasses <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
+ *
  * @author Kevin Poalses
  */
 @ThreadSafe

src/main/java/net/poalsoft/common/util/ConcreteToInterfaceIterable.java

  * @author Kevin Poalses
  */
 public class ConcreteToInterfaceIterable<InterfaceType, ConcreteType> implements Iterable<InterfaceType> {
+
     public ConcreteToInterfaceIterable(Iterable<ConcreteType> concreteTypeIterable) {
         this.concreteTypeIterable = concreteTypeIterable;
     }

src/main/java/net/poalsoft/common/util/TemporaryDirectoryBuilder.java

 package net.poalsoft.common.util;
 
-import java.io.File;
+import javax.annotation.concurrent.ThreadSafe;
+import java.nio.file.Path;
 
 /**
  * A builder to create self-cleaning temporary directories.
  *
+ * <p>Implementations <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
+ *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public interface TemporaryDirectoryBuilder {
 
     /**
      * Builds a self-cleaning temporary directory.
      *
-     * @return File referencing the temporary directory
+     * @return Path referencing the temporary directory
      */
-    File build();
+    Path build();
 
     /**
      * Resets the temporary directory builder to defaults.

src/main/java/net/poalsoft/common/util/Visitor.java

 
 package net.poalsoft.common.util;
 
+import javax.annotation.concurrent.ThreadSafe;
+
 /**
  * An object visitor.
  *
+ * <p>Implementations <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
+ *
  * @author Kevin Poalses
  * @see AbstractVisitor
  * @see Visitable
  */
+@ThreadSafe
 public interface Visitor {
 
     /**

src/main/java/net/poalsoft/common/util/internal/TemporaryDirectoryBuilderImpl.java

 
 import javax.annotation.concurrent.ThreadSafe;
 import javax.inject.Named;
-import java.io.File;
 import java.io.IOException;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
     }
 
     @Override
-    public File build() {
+    public Path build() {
         Path tempDir;
         try {
             tempDir = Files.createTempDirectory(this.tempDirPrefix.get());
         Runtime.getRuntime().addShutdownHook(new DirectoryCleaner(tempDir));
         logger.trace("Added shutdown hook to clean up temporary directory [{}]", tempDir);
 
-        return tempDir.toFile();
+        return tempDir;
     }
 
     @Override

src/main/java/net/poalsoft/common/xml/JaxbContextPool.java

 
 package net.poalsoft.common.xml;
 
+import javax.annotation.concurrent.ThreadSafe;
 import javax.xml.bind.JAXBException;
 import java.util.Collection;
 
 /**
  * A thread-safe JAXB context pool.
  *
+ * <p>Implementations <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
+ *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public interface JaxbContextPool {
 
     /**
-     * Opens a JAXB context for the given classes.
+     * Borrows a JAXB context for the given classes.
+     *
+     * <p>A JAXB context will be created upon pool exhaustion</p>
      *
      * @param classToBeBound        Class to be bound
      * @param extraClassesToBeBound Additional classes to be bound
                               Class<?>... extraClassesToBeBound) throws JAXBException;
 
     /**
-     * Opens a JAXB context for the given classes.
+     * Borrows a JAXB context for the given classes.
+     *
+     * <p>A JAXB context will be created upon pool exhaustion</p>
      *
      * @param classesToBeBound        Class to be bound
      * @return JAXB context
      * @throws javax.xml.bind.JAXBException
      */
     JaxbContext borrowContext(Collection<Class<?>> classesToBeBound) throws JAXBException;
-
-
-
 }

src/main/java/net/poalsoft/common/xml/JaxbMarshallerPool.java

 
 package net.poalsoft.common.xml;
 
+import javax.annotation.concurrent.ThreadSafe;
+
 /**
- * A JAXB marshaller pool.
+ * A thread-safe JAXB marshaller pool.
+ *
+ * <p>Implementations <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
  *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public interface JaxbMarshallerPool {
 
+    /**
+     * Borrows a JAXB marshaller for the given classes from the pool.
+     *
+     * <p>A JAXB marshaller will be created upon pool exhaustion</p>
+     *
+     * @param classToBeMarshalled        Class to be marshalled
+     * @param extraClassesToBeMarshalled Additional classes to be marshalled
+     * @return JAXB marshaller
+     */
     JaxbMarshaller borrowMarshaller(Class<?> classToBeMarshalled,
                                     Class<?>... extraClassesToBeMarshalled);
 

src/main/java/net/poalsoft/common/xml/JaxbUnmarshallerPool.java

 
 package net.poalsoft.common.xml;
 
+import javax.annotation.concurrent.ThreadSafe;
+
 /**
- * A JAXB unmarshaller pool.
+ * A thread-safe JAXB unmarshaller pool.
+ *
+ * <p>Implementations <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
  *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public interface JaxbUnmarshallerPool {
 
+    /**
+     * Borrows a JAXB unmarshaller for the given classes from the pool.
+     *
+     * <p>A JAXB unmarshaller will be created upon pool exhaustion</p>
+     *
+     * @param classToBeUnmarshalled        Class to be unmarshalled
+     * @param extraClassesToBeUnmarshalled Additional classes to be unmarshalled
+     * @return JAXB unmarshaller
+     */
     JaxbUnmarshaller borrowUnmarshaller(Class<?> classToBeUnmarshalled,
                                         Class<?>... extraClassesToBeUnmarshalled);
 

src/main/java/net/poalsoft/common/xml/internal/JaxbContextPoolImpl.java

 import net.poalsoft.common.pool.Pool;
 import net.poalsoft.common.pool.internal.SimplePoolImpl;
 import net.poalsoft.common.xml.JaxbContext;
+import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.context.annotation.Scope;
 
 import javax.annotation.concurrent.ThreadSafe;
  */
 @ThreadSafe
 @Named("jaxbContextPool")
-@Scope("singleton")
+@Scope(BeanDefinition.SCOPE_SINGLETON)
 public class JaxbContextPoolImpl implements JaxbContextPoolSpi {
 
     public JaxbContextPoolImpl() {
                 '}';
     }
 
-    private static final int DEFAULT_MAXIMUM_SIZE_PER_BOUND_CLASS = 20;
+    private static final int DEFAULT_MAXIMUM_SIZE_PER_BOUND_CLASS = 31;
 
     private final Pool<Collection<Class<?>>, JaxbContext> contextPool;
 

src/main/java/net/poalsoft/common/xml/internal/JaxbContextPoolSpi.java

 import net.poalsoft.common.xml.JaxbContext;
 import net.poalsoft.common.xml.JaxbContextPool;
 
+import javax.annotation.concurrent.ThreadSafe;
+
 /**
+ * JAXB context pool service provider interface.
+ *
+ * <p>Implementations <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
+ *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public interface JaxbContextPoolSpi extends JaxbContextPool {
 
+    /**
+     * Returns the given JAXB context to the context pool.
+     *
+     * @param context Context to return to the pool
+     */
     void returnContext(JaxbContext context);
 
 }

src/main/java/net/poalsoft/common/xml/internal/JaxbMarshallerPoolImpl.java

 import net.poalsoft.common.xml.JaxbContext;
 import net.poalsoft.common.xml.JaxbContextPool;
 import net.poalsoft.common.xml.JaxbMarshaller;
+import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.context.annotation.Scope;
 
 import javax.annotation.concurrent.ThreadSafe;
  */
 @ThreadSafe
 @Named("jaxbMarshallerPool")
-@Scope("singleton")
+@Scope(BeanDefinition.SCOPE_SINGLETON)
 public class JaxbMarshallerPoolImpl implements JaxbMarshallerPoolSpi {
 
     @Inject
             throw new RuntimeException("Class to be marshalled may not be null");
         }
 
-        // Return item from pool
+        // Grab an item from the pool
         Set<Class<?>> classesToBeMarshalled =
                 new LinkedHashSet<>(Collections.<Class<?>>singleton(classToBeMarshalled));
         Collections.addAll(classesToBeMarshalled, extraClassesToBeMarshalled);
         if (Marshaller == null) {
             throw new IllegalArgumentException("Marshaller may not be null");
         }
+        // Return item to the pool
         this.marshallerPool.release(Marshaller.getBoundClasses(), Marshaller);
     }
 
                 '}';
     }
 
-    private static final int DEFAULT_MAXIMUM_SIZE_PER_BOUND_CLASS = 20;
+    private static final int DEFAULT_MAXIMUM_SIZE_PER_BOUND_CLASS = 31;
 
     private final Pool<Collection<Class<?>>, JaxbMarshaller> marshallerPool;
 

src/main/java/net/poalsoft/common/xml/internal/JaxbMarshallerPoolSpi.java

 import net.poalsoft.common.xml.JaxbMarshaller;
 import net.poalsoft.common.xml.JaxbMarshallerPool;
 
+import javax.annotation.concurrent.ThreadSafe;
+
 /**
  * A JAXB marshaller pool.
  *
+ * <p>Implementations <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
+ *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public interface JaxbMarshallerPoolSpi extends JaxbMarshallerPool {
 
+    /**
+     * Returns the given JAXB marshaller to the marshaller pool.
+     *
+     * @param marshaller Marshaller to return to the pool
+     */
     void returnMarshaller(JaxbMarshaller marshaller);
 
 }

src/main/java/net/poalsoft/common/xml/internal/JaxbUnmarshallerPoolImpl.java

 import net.poalsoft.common.xml.JaxbContext;
 import net.poalsoft.common.xml.JaxbContextPool;
 import net.poalsoft.common.xml.JaxbUnmarshaller;
+import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.context.annotation.Scope;
 
 import javax.annotation.concurrent.ThreadSafe;
  */
 @ThreadSafe
 @Named("jaxbUnmarshallerPool")
-@Scope("singleton")
+@Scope(BeanDefinition.SCOPE_SINGLETON)
 public class JaxbUnmarshallerPoolImpl implements JaxbUnmarshallerPoolSpi {
 
     @Inject
             throw new RuntimeException("Class to be unmarshalled may not be null");
         }
 
-        // Return item from pool
+        // Grab an item from the pool
         Set<Class<?>> classesToBeUnmarshalled =
                 new LinkedHashSet<>(Collections.<Class<?>>singleton(classToBeUnmarshalled));
         Collections.addAll(classesToBeUnmarshalled, extraClassesToBeUnmarshalled);
         if (unmarshaller == null) {
             throw new IllegalArgumentException("Unmarshaller may not be null");
         }
+        // Return item to the pool
         this.unmarshallerPool.release(unmarshaller.getBoundClasses(), unmarshaller);
     }
 
                 '}';
     }
 
-    private static final int DEFAULT_MAXIMUM_SIZE_PER_BOUND_CLASS = 20;
+    private static final int DEFAULT_MAXIMUM_SIZE_PER_BOUND_CLASS = 31;
 
     private final Pool<Collection<Class<?>>, JaxbUnmarshaller> unmarshallerPool;
 

src/main/java/net/poalsoft/common/xml/internal/JaxbUnmarshallerPoolSpi.java

 import net.poalsoft.common.xml.JaxbUnmarshaller;
 import net.poalsoft.common.xml.JaxbUnmarshallerPool;
 
+import javax.annotation.concurrent.ThreadSafe;
+
 /**
  * A JAXB unmarshaller pool.
  *
+ * <p>Implementations <em>must</em> be {@link javax.annotation.concurrent.ThreadSafe}</p>
+ *
  * @author Kevin Poalses
  */
+@ThreadSafe
 public interface JaxbUnmarshallerPoolSpi extends JaxbUnmarshallerPool {
 
+    /**
+     * Returns the given JAXB unmarshaller to the marshaller pool.
+     *
+     * @param unmarshaller Unmarshaller to return to the pool
+     */
     void returnUnmarshaller(JaxbUnmarshaller unmarshaller);
 
 }

src/main/resources/logback.xml

-<!--
-  ~ Copyright (c) 2010-2012. Kevin Poalses <kevinp@poalsoft.net>
-  ~ All rights reserved.
-  ~
-  ~ Redistribution and use in source and binary forms, with or without
-  ~ modification, are permitted provided that the following conditions are
-  ~ met:
-  ~
-  ~ 1) Redistributions of source code must retain the above copyright notice,
-  ~ this list of conditions and the following disclaimer.
-  ~
-  ~ 2) Redistributions in binary form must reproduce the above copyright
-  ~ notice, this list of conditions and the following disclaimer in the
-  ~ documentation and/or other materials provided with the distribution.
-  ~
-  ~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-  ~ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-  ~ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-  ~ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-  ~ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-  ~ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-  ~ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-  ~ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-  ~ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-  ~ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-  ~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-  -->
-
-<configuration>
-
-    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-        <!-- encoders are assigned the type
-             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
-        <encoder>
-            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
-        </encoder>
-    </appender>
-
-    <root level="info">
-        <appender-ref ref="STDOUT"/>
-    </root>
-
-    <logger name="java.sql" level="warn"/>
-    <logger name="org.hibernate" level="warn"/>
-    <logger name="org.springframework" level="warn"/>
-    <logger name="net.poalsoft.common" level="info"/>
-
-</configuration>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.