Skip to content

Commit

Permalink
DatabaseDataSinkの使い道が不明であるため,削除した.
Browse files Browse the repository at this point in the history
  • Loading branch information
tamada committed Jan 18, 2017
1 parent 533ea2f commit 1ce9030
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 126 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: java
jdk:
- oraclejdk8

env:
secure: "FEVnbx67LZNZEswG4BAs0pgHnLGifjFXYF3I2Ljt7HuW3JUzfzXJB6kl/pJy83Uig2QRrIeEKghsEJsa8D1TnwrWaWUH+PRTXqGnPe3FxWl6lCwh/oWVBLgj6pPAh/0LKpsw5hcw6ZZ590+3yHffvr3s8i1qKSbZGflf7UH3E07c1QHEM2qi8+rjSvuIjOt+ynSS44t6Jiewmc2iAY+J/eBbbLSkgevXo4tpUHhgsEtWqbCHmeKxoXMZX0ty8n+DmzVaZhrr6RCEkyfNIINvuwB2MldHuwCIsunZBTXPZViE8esSxiPPXwef7OwAsYaMzNCSdhmv7j3Gb1uMqCxqG4WpRfSzr+aeK9CcuPmdYXGODiN6MRcHwb/4/wf0F9Axg7vdAIB+fKUTkGDTV3/fwOLjuLcrss9v4uLot9p57t5HdmQ0zLDvIQCtCdlJgjpNssxb13peE8TD4JoD0opTCu9FQoC+gdwyTOkLK4aKTFFr8SNeiL6lx+0DsH8xaICm4BO1CMV/moRBOt6KChIgode7gUlDP2wm34/9EcapVoCaNSDPXHbYw0hPyHlBw59SAihomuEKGPPxX/bUABWzp5vJfSdKQlETNd1oiaEAGR2GnUl6RMYGVk7/uq2U+nAi7PYD0oXOHoMdr/yK7GGq/hR43bTeic514B+J1S5ronY="

after_success:
- mvn -DrepoToken=$COVERALLS_TOKEN clean test jacoco:report coveralls:report

23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
[![Build Status](https://travis-ci.org/tamada/kunai2.svg?branch=master)](https://travis-ci.org/tamada/kunai2)
[![Coverage Status](https://coveralls.io/repos/github/tamada/kunai2/badge.svg?branch=master)](https://coveralls.io/github/tamada/kunai2?branch=master)
[![codebeat badge](https://codebeat.co/badges/2f934b12-6c8e-439a-81e9-694b89789374)](https://codebeat.co/projects/github-com-tamada-kunai2)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat)](https://github.com/tamada/9rules/blob/master/LICENSE)

# kunai2
Kunai for Java 8

This tool is to read/store class files from/to directories, jar file, and war files.
[kunai](https://github.com/tamada/kunai) is same tool, however, kunai is for Java 7 or before.
Kunai2 implemented for Java 8 and used streaming API.

## Simply use.

### Reading

```java
Path path = Paths.get("target/source");
DataSource source = new DefaultDataSourceFactory().build(path);
source.stream();
// some operation for stream.
```

### Storing
155 changes: 57 additions & 98 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,8 @@
</dependency>
</dependencies>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<!-- Sonar -->
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.itReportPath>${project.basedir}/target/jacoco-it.exec</sonar.jacoco.itReportPath>
</properties>

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<sourceDirectory>src/main/java</sourceDirectory>

<resources>
<resource>
Expand All @@ -63,36 +53,34 @@

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
<version>1.1</version>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<encoding>utf-8</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.5</version>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>4.2.0</version>
<configuration>
<inputEncoding>utf-8</inputEncoding>
<outputEncoding>utf-8</outputEncoding>
<locales>en</locales>
<sourceEncoding>utf-8</sourceEncoding>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-markdown</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>com.github.stephenc.wagon</groupId>
<artifactId>wagon-gitsite</artifactId>
<version>0.4.1</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
Expand Down Expand Up @@ -129,6 +117,41 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
<version>1.1</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.5</version>
<configuration>
<inputEncoding>utf-8</inputEncoding>
<outputEncoding>utf-8</outputEncoding>
<locales>en</locales>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-markdown</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>com.github.stephenc.wagon</groupId>
<artifactId>wagon-gitsite</artifactId>
<version>0.4.1</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand All @@ -149,24 +172,10 @@
<version>2.8.1</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>utf-8</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<!--
<configuration>
<argLine>${jacocoArgs}</argLine>
</configuration>
-->
</plugin>

<plugin>
Expand All @@ -181,56 +190,6 @@
</configuration>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<id>prepare-agent</id>
<phase>test-compile</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>Jacoco-prepare-agent-integration</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
<propertyName>invoker.mavenOpts</propertyName>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-it.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
Expand Down
24 changes: 0 additions & 24 deletions src/main/java/com/github/kunai/sink/DatabaseDataSink.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import com.github.kunai.sink.DataSink;

public class DataSinkFactory {
class DataSinkFactory {
private Predicate<Path> predicate;
private Function<Path, DataSink> function;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import com.github.kunai.sink.ClassFileDataSink;
import com.github.kunai.sink.DataSink;
import com.github.kunai.sink.DatabaseDataSink;
import com.github.kunai.sink.DirectoryDataSink;
import com.github.kunai.sink.JarFileDataSink;
import com.github.kunai.sink.WarFileDataSink;
Expand All @@ -18,7 +17,6 @@ public DataSinkFactoryBuilder(){
factories.add(new DataSinkFactory(path -> path.endsWith(".jar"), path -> new JarFileDataSink(path)));
factories.add(new DataSinkFactory(path -> path.endsWith(".war"), path -> new WarFileDataSink(path)));
factories.add(new DataSinkFactory(path -> path.endsWith(".class"), path -> new ClassFileDataSink(path)));
factories.add(new DataSinkFactory(path -> path.endsWith(".db"), path -> new DatabaseDataSink(path)));
factories.add(new DataSinkFactory(path -> true, path -> new DirectoryDataSink(path)));
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/github/kunai/source/DataSource.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.kunai.source;

import java.io.IOException;
import java.util.function.Consumer;
import java.util.stream.Stream;

import com.github.kunai.entries.Entry;
Expand All @@ -13,6 +14,10 @@
public interface DataSource extends AutoCloseable{
Stream<Entry> stream();

default void forEach(Consumer<Entry> consumer){
stream().forEach(consumer);
}

@Override
void close() throws IOException;
}

0 comments on commit 1ce9030

Please sign in to comment.