Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 05fe4eb

Browse files
committed
Merge branch 'release/1.3.0'
2 parents 6ecd2b5 + a88bd78 commit 05fe4eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+6682
-6347
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ before_script:
1818
- chmod a+x ./print_surefire_reports.sh
1919
script: mvn clean install
2020
after_success:
21-
- mvn jacoco:report coveralls:jacoco
21+
- mvn jacoco:report coveralls:report
2222
after_failure: ./print_surefire_reports.sh

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This project provides a first API implementation, little optimized, but "complet
1414
<dependency>
1515
<groupId>com.upplication</groupId>
1616
<artifactId>s3fs</artifactId>
17-
<version>1.2.3</version>
17+
<version>1.3.0</version>
1818
</dependency>
1919
```
2020

pom.xml

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.upplication</groupId>
55
<artifactId>s3fs</artifactId>
66
<packaging>jar</packaging>
7-
<version>1.2.3</version>
7+
<version>1.3.0</version>
88
<name>s3fs</name>
99
<description>S3 filesystem provider for Java 7</description>
1010
<url>https://github.com/Upplication/Amazon-S3-FileSystem-NIO2</url>
@@ -216,69 +216,78 @@
216216
</property>
217217
</activation>
218218
<build>
219-
<plugins>
220-
<plugin>
221-
<groupId>org.apache.maven.plugins</groupId>
222-
<artifactId>maven-failsafe-plugin</artifactId>
223-
<version>${maven.surfire.plugin.version}</version>
224-
<configuration>
225-
<includes>
226-
<include>**/*IT.java</include>
227-
</includes>
228-
</configuration>
229-
<executions>
230-
<execution>
231-
<id>integration-test</id>
232-
<phase>integration-test</phase>
233-
<goals>
234-
<goal>integration-test</goal>
235-
</goals>
236-
</execution>
237-
<execution>
238-
<id>verify</id>
239-
<phase>verify</phase>
240-
<goals>
241-
<goal>verify</goal>
242-
</goals>
243-
</execution>
244-
</executions>
245-
</plugin>
246-
</plugins>
247-
</build>
248-
</profile>
249-
<profile>
250-
<id>travis</id>
251-
<activation>
252-
<property>
253-
<name>env.TRAVIS</name>
254-
<value>true</value>
255-
</property>
256-
</activation>
257-
<build>
258219
<plugins>
220+
<plugin>
221+
<groupId>org.apache.maven.plugins</groupId>
222+
<artifactId>maven-surefire-plugin</artifactId>
223+
<configuration>
224+
<argLine>${jacoco.agent.arg}</argLine>
225+
</configuration>
226+
</plugin>
227+
<plugin>
228+
<groupId>org.apache.maven.plugins</groupId>
229+
<artifactId>maven-failsafe-plugin</artifactId>
230+
<version>2.7.1</version>
231+
<configuration>
232+
<includes>
233+
<include>**/*IT.java</include>
234+
</includes>
235+
<argLine>${jacoco.agent.arg}</argLine>
236+
</configuration>
237+
<executions>
238+
<execution>
239+
<id>integration-test</id>
240+
<phase>integration-test</phase>
241+
<goals>
242+
<goal>integration-test</goal>
243+
</goals>
244+
</execution>
245+
<execution>
246+
<id>verify</id>
247+
<phase>verify</phase>
248+
<goals>
249+
<goal>verify</goal>
250+
</goals>
251+
</execution>
252+
</executions>
253+
</plugin>
254+
259255
<plugin>
260256
<groupId>org.eluder.coveralls</groupId>
261257
<artifactId>coveralls-maven-plugin</artifactId>
262-
<version>2.2.0</version>
258+
<version>4.1.0</version>
263259
</plugin>
260+
264261
<plugin>
265262
<groupId>org.jacoco</groupId>
266263
<artifactId>jacoco-maven-plugin</artifactId>
267-
<version>0.6.4.201312101107</version>
264+
<version>0.7.6.201602180812</version>
265+
268266
<executions>
267+
<!-- Prepare execution with Surefire -->
269268
<execution>
270-
<id>prepare-agent</id>
269+
<id>pre-unit-test</id>
271270
<goals>
272271
<goal>prepare-agent</goal>
273272
</goals>
273+
<configuration>
274+
<propertyName>jacoco.agent.arg</propertyName>
275+
<append>true</append>
276+
</configuration>
277+
</execution>
278+
<!-- Generate report after tests are run -->
279+
<execution>
280+
<id>post-unit-test</id>
281+
<phase>integration-test</phase>
282+
<goals>
283+
<goal>report</goal>
284+
</goals>
274285
</execution>
275286
</executions>
276287
</plugin>
277288
</plugins>
278-
</build>
279-
</profile>
280-
281-
289+
</build>
290+
</profile>
282291
<profile>
283292
<id>release-sign-artifacts</id>
284293

src/main/java/com/upplication/s3fs/AmazonS3ClientFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import com.amazonaws.services.s3.AmazonS3Client;
77

88
public class AmazonS3ClientFactory extends AmazonS3Factory {
9-
@Override
10-
protected AmazonS3Client createAmazonS3(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricsCollector) {
11-
return new AmazonS3Client(credentialsProvider, clientConfiguration, requestMetricsCollector);
12-
}
9+
@Override
10+
protected AmazonS3Client createAmazonS3(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricsCollector) {
11+
return new AmazonS3Client(credentialsProvider, clientConfiguration, requestMetricsCollector);
12+
}
1313
}

src/main/java/com/upplication/s3fs/AmazonS3Factory.java

Lines changed: 85 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -20,100 +20,101 @@
2020
*/
2121
public abstract class AmazonS3Factory {
2222

23-
public static final String ACCESS_KEY = "s3fs_access_key";
24-
public static final String SECRET_KEY = "s3fs_secret_key";
25-
public static final String REQUEST_METRIC_COLLECTOR_CLASS = "s3fs_request_metric_collector_class";
26-
public static final String CONNECTION_TIMEOUT = "s3fs_connection_timeout";
27-
public static final String MAX_CONNECTIONS = "s3fs_max_connections";
28-
public static final String MAX_ERROR_RETRY = "s3fs_max_retry_error";
29-
public static final String PROTOCOL = "s3fs_protocol";
30-
public static final String PROXY_DOMAIN = "s3fs_proxy_domain";
31-
public static final String PROXY_HOST = "s3fs_proxy_host";
32-
public static final String PROXY_PASSWORD = "s3fs_proxy_password";
33-
public static final String PROXY_PORT = "s3fs_proxy_port";
34-
public static final String PROXY_USERNAME = "s3fs_proxy_username";
35-
public static final String PROXY_WORKSTATION = "s3fs_proxy_workstation";
36-
public static final String SOCKET_SEND_BUFFER_SIZE_HINT = "s3fs_socket_send_buffer_size_hint";
37-
public static final String SOCKET_RECEIVE_BUFFER_SIZE_HINT = "s3fs_socket_receive_buffer_size_hint";
38-
public static final String SOCKET_TIMEOUT = "s3fs_socket_timeout";
39-
public static final String USER_AGENT = "s3fs_user_agent";
23+
public static final String ACCESS_KEY = "s3fs_access_key";
24+
public static final String SECRET_KEY = "s3fs_secret_key";
25+
public static final String REQUEST_METRIC_COLLECTOR_CLASS = "s3fs_request_metric_collector_class";
26+
public static final String CONNECTION_TIMEOUT = "s3fs_connection_timeout";
27+
public static final String MAX_CONNECTIONS = "s3fs_max_connections";
28+
public static final String MAX_ERROR_RETRY = "s3fs_max_retry_error";
29+
public static final String PROTOCOL = "s3fs_protocol";
30+
public static final String PROXY_DOMAIN = "s3fs_proxy_domain";
31+
public static final String PROXY_HOST = "s3fs_proxy_host";
32+
public static final String PROXY_PASSWORD = "s3fs_proxy_password";
33+
public static final String PROXY_PORT = "s3fs_proxy_port";
34+
public static final String PROXY_USERNAME = "s3fs_proxy_username";
35+
public static final String PROXY_WORKSTATION = "s3fs_proxy_workstation";
36+
public static final String SOCKET_SEND_BUFFER_SIZE_HINT = "s3fs_socket_send_buffer_size_hint";
37+
public static final String SOCKET_RECEIVE_BUFFER_SIZE_HINT = "s3fs_socket_receive_buffer_size_hint";
38+
public static final String SOCKET_TIMEOUT = "s3fs_socket_timeout";
39+
public static final String USER_AGENT = "s3fs_user_agent";
4040

41-
protected Logger logger = LoggerFactory.getLogger(getClass());
41+
protected Logger logger = LoggerFactory.getLogger(getClass());
4242

4343
/**
4444
* should return a new AmazonS3
45-
* @param credentialsProvider AWSCredentialsProvider mandatory
46-
* @param clientConfiguration ClientConfiguration mandatory
45+
*
46+
* @param credentialsProvider AWSCredentialsProvider mandatory
47+
* @param clientConfiguration ClientConfiguration mandatory
4748
* @param requestMetricsCollector RequestMetricCollector mandatory
4849
* @return {@link com.amazonaws.services.s3.AmazonS3}
4950
*/
50-
protected abstract AmazonS3 createAmazonS3(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricsCollector);
51+
protected abstract AmazonS3 createAmazonS3(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricsCollector);
5152

52-
public AmazonS3 getAmazonS3(URI uri, Properties props) {
53-
AmazonS3 client = createAmazonS3(getCredentialsProvider(props), getClientConfiguration(props), getRequestMetricsCollector(props));
54-
if (uri.getHost() != null)
55-
client.setEndpoint(uri.getHost());
56-
return client;
57-
}
53+
public AmazonS3 getAmazonS3(URI uri, Properties props) {
54+
AmazonS3 client = createAmazonS3(getCredentialsProvider(props), getClientConfiguration(props), getRequestMetricsCollector(props));
55+
if (uri.getHost() != null)
56+
client.setEndpoint(uri.getHost());
57+
return client;
58+
}
5859

59-
protected AWSCredentialsProvider getCredentialsProvider(Properties props) {
60-
AWSCredentialsProvider credentialsProvider;
61-
if (props.getProperty(ACCESS_KEY) == null && props.getProperty(SECRET_KEY) == null)
62-
credentialsProvider = new DefaultAWSCredentialsProviderChain();
63-
else
64-
credentialsProvider = new StaticCredentialsProvider(getAWSCredentials(props));
65-
return credentialsProvider;
66-
}
60+
protected AWSCredentialsProvider getCredentialsProvider(Properties props) {
61+
AWSCredentialsProvider credentialsProvider;
62+
if (props.getProperty(ACCESS_KEY) == null && props.getProperty(SECRET_KEY) == null)
63+
credentialsProvider = new DefaultAWSCredentialsProviderChain();
64+
else
65+
credentialsProvider = new StaticCredentialsProvider(getAWSCredentials(props));
66+
return credentialsProvider;
67+
}
6768

68-
protected RequestMetricCollector getRequestMetricsCollector(Properties props) {
69-
RequestMetricCollector requestMetricCollector = null;
70-
if (props.containsKey(REQUEST_METRIC_COLLECTOR_CLASS)) {
71-
try {
72-
requestMetricCollector = (RequestMetricCollector) Class.forName(props.getProperty(REQUEST_METRIC_COLLECTOR_CLASS)).newInstance();
73-
} catch (Throwable t) {
74-
throw new IllegalArgumentException("Can't instantiate REQUEST_METRIC_COLLECTOR_CLASS " + props.getProperty(REQUEST_METRIC_COLLECTOR_CLASS), t);
75-
}
76-
}
77-
return requestMetricCollector;
78-
}
69+
protected RequestMetricCollector getRequestMetricsCollector(Properties props) {
70+
RequestMetricCollector requestMetricCollector = null;
71+
if (props.containsKey(REQUEST_METRIC_COLLECTOR_CLASS)) {
72+
try {
73+
requestMetricCollector = (RequestMetricCollector) Class.forName(props.getProperty(REQUEST_METRIC_COLLECTOR_CLASS)).newInstance();
74+
} catch (Throwable t) {
75+
throw new IllegalArgumentException("Can't instantiate REQUEST_METRIC_COLLECTOR_CLASS " + props.getProperty(REQUEST_METRIC_COLLECTOR_CLASS), t);
76+
}
77+
}
78+
return requestMetricCollector;
79+
}
7980

80-
protected ClientConfiguration getClientConfiguration(Properties props) {
81-
ClientConfiguration clientConfiguration = new ClientConfiguration();
82-
if (props.getProperty(CONNECTION_TIMEOUT) != null)
83-
clientConfiguration.setConnectionTimeout(Integer.parseInt(props.getProperty(CONNECTION_TIMEOUT)));
84-
if (props.getProperty(MAX_CONNECTIONS) != null)
85-
clientConfiguration.setMaxConnections(Integer.parseInt(props.getProperty(MAX_CONNECTIONS)));
86-
if (props.getProperty(MAX_ERROR_RETRY) != null)
87-
clientConfiguration.setMaxErrorRetry(Integer.parseInt(props.getProperty(MAX_ERROR_RETRY)));
88-
if (props.getProperty(PROTOCOL) != null)
89-
clientConfiguration.setProtocol(Protocol.valueOf(props.getProperty(PROTOCOL)));
90-
if (props.getProperty(PROXY_DOMAIN) != null)
91-
clientConfiguration.setProxyDomain(props.getProperty(PROXY_DOMAIN));
92-
if (props.getProperty(PROXY_HOST) != null)
93-
clientConfiguration.setProxyHost(props.getProperty(PROXY_HOST));
94-
if (props.getProperty(PROXY_PASSWORD) != null)
95-
clientConfiguration.setProxyPassword(props.getProperty(PROXY_PASSWORD));
96-
if (props.getProperty(PROXY_PORT) != null)
97-
clientConfiguration.setProxyPort(Integer.parseInt(props.getProperty(PROXY_PORT)));
98-
if (props.getProperty(PROXY_USERNAME) != null)
99-
clientConfiguration.setProxyUsername(props.getProperty(PROXY_USERNAME));
100-
if (props.getProperty(PROXY_WORKSTATION) != null)
101-
clientConfiguration.setProxyWorkstation(props.getProperty(PROXY_WORKSTATION));
102-
int socketSendBufferSizeHint = 0;
103-
if (props.getProperty(SOCKET_SEND_BUFFER_SIZE_HINT) != null)
104-
socketSendBufferSizeHint = Integer.parseInt(props.getProperty(SOCKET_SEND_BUFFER_SIZE_HINT));
105-
int socketReceiveBufferSizeHint = 0;
106-
if (props.getProperty(SOCKET_RECEIVE_BUFFER_SIZE_HINT) != null)
107-
socketReceiveBufferSizeHint = Integer.parseInt(props.getProperty(SOCKET_RECEIVE_BUFFER_SIZE_HINT));
108-
clientConfiguration.setSocketBufferSizeHints(socketSendBufferSizeHint, socketReceiveBufferSizeHint);
109-
if (props.getProperty(SOCKET_TIMEOUT) != null)
110-
clientConfiguration.setSocketTimeout(Integer.parseInt(props.getProperty(SOCKET_TIMEOUT)));
111-
if (props.getProperty(USER_AGENT) != null)
112-
clientConfiguration.setUserAgent(props.getProperty(USER_AGENT));
113-
return clientConfiguration;
114-
}
81+
protected ClientConfiguration getClientConfiguration(Properties props) {
82+
ClientConfiguration clientConfiguration = new ClientConfiguration();
83+
if (props.getProperty(CONNECTION_TIMEOUT) != null)
84+
clientConfiguration.setConnectionTimeout(Integer.parseInt(props.getProperty(CONNECTION_TIMEOUT)));
85+
if (props.getProperty(MAX_CONNECTIONS) != null)
86+
clientConfiguration.setMaxConnections(Integer.parseInt(props.getProperty(MAX_CONNECTIONS)));
87+
if (props.getProperty(MAX_ERROR_RETRY) != null)
88+
clientConfiguration.setMaxErrorRetry(Integer.parseInt(props.getProperty(MAX_ERROR_RETRY)));
89+
if (props.getProperty(PROTOCOL) != null)
90+
clientConfiguration.setProtocol(Protocol.valueOf(props.getProperty(PROTOCOL)));
91+
if (props.getProperty(PROXY_DOMAIN) != null)
92+
clientConfiguration.setProxyDomain(props.getProperty(PROXY_DOMAIN));
93+
if (props.getProperty(PROXY_HOST) != null)
94+
clientConfiguration.setProxyHost(props.getProperty(PROXY_HOST));
95+
if (props.getProperty(PROXY_PASSWORD) != null)
96+
clientConfiguration.setProxyPassword(props.getProperty(PROXY_PASSWORD));
97+
if (props.getProperty(PROXY_PORT) != null)
98+
clientConfiguration.setProxyPort(Integer.parseInt(props.getProperty(PROXY_PORT)));
99+
if (props.getProperty(PROXY_USERNAME) != null)
100+
clientConfiguration.setProxyUsername(props.getProperty(PROXY_USERNAME));
101+
if (props.getProperty(PROXY_WORKSTATION) != null)
102+
clientConfiguration.setProxyWorkstation(props.getProperty(PROXY_WORKSTATION));
103+
int socketSendBufferSizeHint = 0;
104+
if (props.getProperty(SOCKET_SEND_BUFFER_SIZE_HINT) != null)
105+
socketSendBufferSizeHint = Integer.parseInt(props.getProperty(SOCKET_SEND_BUFFER_SIZE_HINT));
106+
int socketReceiveBufferSizeHint = 0;
107+
if (props.getProperty(SOCKET_RECEIVE_BUFFER_SIZE_HINT) != null)
108+
socketReceiveBufferSizeHint = Integer.parseInt(props.getProperty(SOCKET_RECEIVE_BUFFER_SIZE_HINT));
109+
clientConfiguration.setSocketBufferSizeHints(socketSendBufferSizeHint, socketReceiveBufferSizeHint);
110+
if (props.getProperty(SOCKET_TIMEOUT) != null)
111+
clientConfiguration.setSocketTimeout(Integer.parseInt(props.getProperty(SOCKET_TIMEOUT)));
112+
if (props.getProperty(USER_AGENT) != null)
113+
clientConfiguration.setUserAgent(props.getProperty(USER_AGENT));
114+
return clientConfiguration;
115+
}
115116

116-
protected BasicAWSCredentials getAWSCredentials(Properties props) {
117-
return new BasicAWSCredentials(props.getProperty(ACCESS_KEY), props.getProperty(SECRET_KEY));
118-
}
117+
protected BasicAWSCredentials getAWSCredentials(Properties props) {
118+
return new BasicAWSCredentials(props.getProperty(ACCESS_KEY), props.getProperty(SECRET_KEY));
119+
}
119120
}

0 commit comments

Comments
 (0)