RAT (Release Audit Tool) results

The following document contains the results of RAT (Release Audit Tool).

*****************************************************
Summary
-------
Notes: 0
Binaries: 10
Archives: 0
Standards: 25

Apache Licensed: 13
Generated Documents: 0

JavaDocs are generated and so license header is optional
Generated files do not required license headers

12 Unknown Licenses

*******************************

Unapproved licenses:

  examples/file_store.csv
  pom.xml
  src/main/java/com/ning/metrics/goodwill/binder/listeners/GoodwillGuiceListener.java
  src/main/java/com/ning/metrics/goodwill/binder/modules/GoodwillSinkProvider.java
  src/main/java/com/ning/metrics/goodwill/binder/modules/GoodwillStoreProvider.java
  src/main/java/com/ning/metrics/goodwill/dao/DAOAccess.java
  src/main/java/com/ning/metrics/goodwill/dao/DAOBoneCPAccess.java
  src/main/java/com/ning/metrics/goodwill/dao/DAOUtil.java
  src/main/java/com/ning/metrics/goodwill/endpoint/Sink.java
  src/main/java/com/ning/metrics/goodwill/modules/ThriftRegistrar.java
  src/main/java/com/ning/metrics/goodwill/sink/GoodwillSink.java
  src/main/java/com/ning/metrics/goodwill/sink/NetezzaSink.java

*******************************

Archives:

*****************************************************
  Files with Apache License headers will be marked AL
  Binary files (which do not require AL headers) will be marked B
  Compressed archives will be marked A
  Notices, licenses etc will be marked N
 !????? examples/file_store.csv
  AL    LICENSE-2.0.txt
 !????? pom.xml
  AL    src/main/java/com/ning/metrics/goodwill/binder/config/GoodwillConfig.java
 !????? src/main/java/com/ning/metrics/goodwill/binder/listeners/GoodwillGuiceListener.java
  AL    src/main/java/com/ning/metrics/goodwill/binder/modules/GoodwillServicesModule.java
 !????? src/main/java/com/ning/metrics/goodwill/binder/modules/GoodwillSinkProvider.java
 !????? src/main/java/com/ning/metrics/goodwill/binder/modules/GoodwillStoreProvider.java
 !????? src/main/java/com/ning/metrics/goodwill/dao/DAOAccess.java
 !????? src/main/java/com/ning/metrics/goodwill/dao/DAOBoneCPAccess.java
 !????? src/main/java/com/ning/metrics/goodwill/dao/DAOUtil.java
  AL    src/main/java/com/ning/metrics/goodwill/endpoint/Registrar.java
 !????? src/main/java/com/ning/metrics/goodwill/endpoint/Sink.java
 !????? src/main/java/com/ning/metrics/goodwill/modules/ThriftRegistrar.java
 !????? src/main/java/com/ning/metrics/goodwill/sink/GoodwillSink.java
 !????? src/main/java/com/ning/metrics/goodwill/sink/NetezzaSink.java
  AL    src/main/java/com/ning/metrics/goodwill/store/CSVFileStore.java
  AL    src/main/java/com/ning/metrics/goodwill/store/GoodwillStore.java
  AL    src/main/java/com/ning/metrics/goodwill/store/MySQLStore.java
  AL    src/main/resources/log4j.xml
  AL    src/main/webapp/css/global.css
  B     src/main/webapp/images/add-hover.png
  B     src/main/webapp/images/add.png
  B     src/main/webapp/images/blue.png
  B     src/main/webapp/images/blue2-hover.png
  B     src/main/webapp/images/blue2-hover.pxm
  B     src/main/webapp/images/blue2.png
  B     src/main/webapp/images/link-hover.png
  B     src/main/webapp/images/link.png
  B     src/main/webapp/images/Remove2-hover.png
  B     src/main/webapp/images/Remove2.png
  AL    src/main/webapp/registrar/index.html
  AL    src/main/webapp/registrar/type.jsp
  AL    src/main/webapp/WEB-INF/web.xml
  AL    src/test/java/com/ning/metrics/goodwill/store/MySQLStoreTest.java
 
 *****************************************************
 Printing headers for files without AL header...
 
 
 =======================================================================
 ==examples/file_store.csv
 =======================================================================
"EVENTTYPE","FIELDID","FIELDTYPE","FIELDNAME","MINVERSION","MAXVERSION"
"Awesomeness",1,"date","date",1,2147483647
"Awesomeness",2,"string","cat",1,2147483647
"Awesomeness",3,"double","puppy_quotient",1,2147483647
"Awesomeness",4,"i16","stars",1,2147483647

 =======================================================================
 ==pom.xml
 =======================================================================
<?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/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>com.ning</groupId>
        <artifactId>metrics.base-pom</artifactId>
        <version>0.0.3</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ning</groupId>
    <artifactId>metrics.goodwill</artifactId>
    <packaging>war</packaging>
    <version>1.2.3-SNAPSHOT</version>
    <name>goodwill</name>
    <description>Store for sharing schemata (Thrift, Smile, ...) between HDFS, DataWarehouses, and other</description>
    <url>http://github.com/pierre/goodwill</url>
    <scm>
        <connection>scm:git:git://github.com/pierre/goodwill.git</connection>
        <developerConnection>scm:git:git@github.com:pierre/goodwill.git</developerConnection>
        <url>http://github.com/pierre/goodwill/tree/master</url>
    </scm>
    <dependencies>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.inject.extensions</groupId>
            <artifactId>guice-multibindings</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.inject.extensions</groupId>
            <artifactId>guice-servlet</artifactId>
        </dependency>
        <dependency>
            <groupId>com.jolbox</groupId>
            <artifactId>bonecp</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ning</groupId>
            <artifactId>metrics.goodwill-access</artifactId>
        </dependency>

 =======================================================================
 ==src/main/java/com/ning/metrics/goodwill/binder/listeners/GoodwillGuiceListener.java
 =======================================================================
package com.ning.metrics.goodwill.binder.listeners;

import com.ning.jetty.base.modules.ServerModuleBuilder;
import com.ning.jetty.core.listeners.SetupServer;
import com.ning.jetty.utils.healthchecks.DBIHealthCheck;
import com.ning.jetty.utils.log4j.Log4JMBean;
import com.ning.metrics.goodwill.binder.config.GoodwillConfig;
import com.ning.metrics.goodwill.binder.modules.GoodwillServicesModule;

import javax.servlet.ServletContextEvent;

public class GoodwillGuiceListener extends SetupServer
{
    @Override
    public void contextInitialized(ServletContextEvent event)
    {
        final ServerModuleBuilder builder = new ServerModuleBuilder()
            .addConfig(GoodwillConfig.class)
            .addJMXExport(Log4JMBean.class)
            .setAreciboProfile(System.getProperty("action.arecibo.profile", "ning.jmx:name=MonitoringProfile"))
            .addModule(new GoodwillServicesModule())
            .addResource("com.ning.metrics.goodwill.endpoint");

        guiceModule = builder.build();

        super.contextInitialized(event);
    }
}

 =======================================================================
 ==src/main/java/com/ning/metrics/goodwill/binder/modules/GoodwillSinkProvider.java
 =======================================================================
package com.ning.metrics.goodwill.binder.modules;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.ning.metrics.goodwill.binder.config.GoodwillConfig;
import com.ning.metrics.goodwill.sink.GoodwillSink;
import com.ning.metrics.goodwill.sink.NetezzaSink;
import org.apache.log4j.Logger;

public class GoodwillSinkProvider implements Provider<GoodwillSink>
{
    private static final Logger log = Logger.getLogger(GoodwillSinkProvider.class);

    private final GoodwillConfig config;

    @Inject
    public GoodwillSinkProvider(final GoodwillConfig config)
    {
        this.config = config;
    }

    @Override
    public GoodwillSink get()
    {
        final String sinkType = config.getSinkType();
        if (sinkType == null) {
            return null;
        }
        else if (sinkType.equals("netezza")) {
            log.info("Enabled Netezza sink");
            return new NetezzaSink(config);
        }
        else {
            throw new IllegalStateException("Unknown sink type " + sinkType);
        }
    }
}

 =======================================================================
 ==src/main/java/com/ning/metrics/goodwill/binder/modules/GoodwillStoreProvider.java
 =======================================================================
package com.ning.metrics.goodwill.binder.modules;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.ning.metrics.goodwill.binder.config.GoodwillConfig;
import com.ning.metrics.goodwill.dao.DAOBoneCPAccess;
import com.ning.metrics.goodwill.store.CSVFileStore;
import com.ning.metrics.goodwill.store.GoodwillStore;
import com.ning.metrics.goodwill.store.MySQLStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

public class GoodwillStoreProvider implements Provider<GoodwillStore>
{
    private static final Logger log = LoggerFactory.getLogger(GoodwillServicesModule.class);

    private final GoodwillConfig config;

    @Inject
    public GoodwillStoreProvider(final GoodwillConfig config)
    {
        this.config = config;
    }

    @Override
    public GoodwillStore get()
    {
        final String storeType = config.getStoreType();
        if (storeType.equals("mysql")) {
            log.info("Enabling MySQL store");
            try {
                return new MySQLStore(config, new DAOBoneCPAccess(config));
            }
            catch (IOException e) {
                log.error("Unable to connect to MySQL", e);
            }
        }
        else if (storeType.equals("csv")) {
            log.info("Enabling CSV store");
            try {
                return new CSVFileStore(config);
            }
            catch (IOException e) {
                log.error("Unable to create the CSV file store", e);
            }
        }
        else {
            throw new IllegalStateException("Unknown store type " + storeType);

 =======================================================================
 ==src/main/java/com/ning/metrics/goodwill/dao/DAOAccess.java
 =======================================================================
package com.ning.metrics.goodwill.dao;

import javax.sql.DataSource;

public interface DAOAccess
{
    public DataSource getDataSource();
}

 =======================================================================
 ==src/main/java/com/ning/metrics/goodwill/dao/DAOBoneCPAccess.java
 =======================================================================
package com.ning.metrics.goodwill.dao;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.jolbox.bonecp.BoneCPConfig;
import com.jolbox.bonecp.BoneCPDataSource;
import com.ning.metrics.goodwill.binder.config.GoodwillConfig;

import javax.sql.DataSource;

@Singleton
public class DAOBoneCPAccess implements DAOAccess
{
    private final DataSource dataSource;

    @Inject
    public DAOBoneCPAccess(
        GoodwillConfig config
    )
    {
        this(config.getStoreDBHost(), config.getStoreDBPort(), config.getStoreDBName(), config.getStoreDBUsername(), config.getStoreDBPassword());

    }

    public DAOBoneCPAccess(String DBHost,
                               int DBPort,
                               String DBName,
                               String DBUsername,
                               String DBPassword)
    {
        BoneCPConfig boneCPConfig = new BoneCPConfig();

        boneCPConfig.setJdbcUrl(String.format("jdbc:mysql://%s:%d/%s", DBHost, DBPort, DBName));
        boneCPConfig.setUsername(DBUsername);
        boneCPConfig.setPassword(DBPassword);
        boneCPConfig.setMinConnectionsPerPartition(1);
        boneCPConfig.setMaxConnectionsPerPartition(10);
        boneCPConfig.setPartitionCount(1);

        dataSource = new BoneCPDataSource(boneCPConfig);
    }

    @Override
    public DataSource getDataSource()
    {
        return dataSource;
    }
}

 =======================================================================
 ==src/main/java/com/ning/metrics/goodwill/dao/DAOUtil.java
 =======================================================================
package com.ning.metrics.goodwill.dao;


import com.ning.metrics.goodwill.store.MySQLStore;
import org.apache.log4j.Logger;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public final class DAOUtil
{
    private static Logger log = Logger.getLogger(MySQLStore.class);

    /**
     * Quietly close the Connection
     *
     * @param connection The Connection to be closed quietly
     */
    public static void close(Connection connection)
    {
        if (connection != null) {
            try {
                connection.close();
            }
            catch (SQLException e) {
                log.warn("Closing Connection failed: " + e.getLocalizedMessage(), e);
            }
        }
    }

    /**
     * Quietly close the Statement
     *
     * @param statement The Statement to be closed quietly
     */
    public static void close(Statement statement)
    {
        if (statement != null) {
            try {
                statement.close();
            }
            catch (SQLException e) {
                log.warn("Closing Statement failed: " + e.getLocalizedMessage(), e);
            }
        }
    }

    /**

 =======================================================================
 ==src/main/java/com/ning/metrics/goodwill/endpoint/Sink.java
 =======================================================================
package com.ning.metrics.goodwill.endpoint;

import com.google.inject.Inject;
import com.ning.metrics.goodwill.access.GoodwillSchema;
import com.ning.metrics.goodwill.sink.GoodwillSink;
import com.ning.metrics.goodwill.store.GoodwillStore;
import org.apache.log4j.Logger;

import javax.annotation.Nullable;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

@Path("sink")
public class Sink
{
    private Logger log = Logger.getLogger(Sink.class);

    private GoodwillStore store;
    private final GoodwillSink sink;

    @Inject
    public Sink(
        GoodwillStore store,
        @Nullable GoodwillSink sink
    )
    {
        this.store = store;
        this.sink = sink;
    }

    @POST
    @Path("/{type}/")
    @Produces(MediaType.TEXT_PLAIN)
    public Response addTypeToSink(@PathParam("type") String typeName) throws Exception
    {
        GoodwillSchema typeFound = store.findByName(typeName);

        log.debug(String.format("Found type: %s", typeFound));
        if (typeFound != null) {
            if (sink.addType(typeFound)) {
                return Response.status(Response.Status.CREATED).build();
            }
            else {
                return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
            }
        }

 =======================================================================
 ==src/main/java/com/ning/metrics/goodwill/modules/ThriftRegistrar.java
 =======================================================================
package com.ning.metrics.goodwill.modules;

import java.io.ByteArrayOutputStream;

public class ThriftRegistrar
{
    private final ByteArrayOutputStream storeInJSON;
    private String actionCoreURL;

    public ThriftRegistrar(ByteArrayOutputStream storeInJSON)
    {
        this.storeInJSON = storeInJSON;
    }

    public ByteArrayOutputStream getStoreInJSON()
    {
        return storeInJSON;
    }

    /**
     * Setter for the actionCoreURL field.
     * The action core is an open-source HDFS front-end, similar to the one provided by the Namenode,
     * but on steroids.
     *
     * @param actionCoreURL URL to the action core instance
     * @link http://github.com/pierre/action-core
     */
    public void setActionCoreURL(String actionCoreURL)
    {
        this.actionCoreURL = actionCoreURL;
    }

    public String getActionCoreURL()
    {
        return actionCoreURL;
    }
}

 =======================================================================
 ==src/main/java/com/ning/metrics/goodwill/sink/GoodwillSink.java
 =======================================================================
package com.ning.metrics.goodwill.sink;

import com.ning.metrics.goodwill.access.GoodwillSchema;

public interface GoodwillSink
{
    /**
     * Add a new type to the sink
     *
     * @param schema GoodwillSchema to add
     * @return true on success, false otherwise
     * @throws Exception if an exception occurs talking to the sink
     */
    public boolean addType(GoodwillSchema schema) throws Exception;

    /**
     * Update a type to the sink
     *
     * @param schema GoodwillSchema to update
     * @return true is success, false otherwise
     */
    public boolean updateType(GoodwillSchema schema);

    /**
     * Give human readable information on how to add a Type in the sink
     * This is used in the UI
     *
     * @param schema GoodwillSchema to add
     * @return info how to create a Type in the sink
     */
    public String addTypeInfo(GoodwillSchema schema);
}

 =======================================================================
 ==src/main/java/com/ning/metrics/goodwill/sink/NetezzaSink.java
 =======================================================================
package com.ning.metrics.goodwill.sink;

import com.google.inject.Inject;
import com.ning.metrics.goodwill.access.GoodwillSchema;
import com.ning.metrics.goodwill.access.GoodwillSchemaField;
import com.ning.metrics.goodwill.binder.config.GoodwillConfig;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.netezza.datasource.NzDatasource;

import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class NetezzaSink implements GoodwillSink
{
    private final Logger log = Logger.getLogger(NetezzaSink.class);

    private final GoodwillConfig config;

    @Inject
    public NetezzaSink(
        GoodwillConfig config
    )
    {
        this.config = config;
    }

    /**
     * Add a new type to the sink
     * <p/>
     * For Netezza, this means creating a table where the data can be dumped. The CREATE TABLE statement
     * is constructed from the SQL information documented in the ThriftFields.
     *
     * @param schema GoodwillSchema to add
     */
    @Override
    public boolean addType(GoodwillSchema schema)
        throws SQLException, IOException, ClassNotFoundException
    {
        boolean success = false;

        try {
            Connection connection = connectToNetezza(config.getSinkDBFirstHost(), config.getSinkDBFirstPort(), config.getSinkDBFirstSchema(),
                config.getSinkDBFirstUsername(), config.getSinkDBFirstPassword());

            String createTableStatement = getCreateTableStatement(schema);
            Statement statement = connection.createStatement();
            statement.addBatch(createTableStatement);