Skip to content

Commit c5198dc

Browse files
viniciusccarvalhoartembilan
authored andcommitted
Refactoring for modules
* Move SI-related components to the `spring-integration-gcp` module * Add `starters` sub-project * Move auto-configurations to appropriate starters * Reorganize dependencies a bit * add `.jdk8` indicator files for animal-sniffer plugin * Fix `GoogleStorageProtocolResolver` do not delegate to the `DefaultResourceLoader` delegate, since that is already its responsibility to deal with the `null` from its `protocolResolvers`
1 parent 2d28b57 commit c5198dc

File tree

26 files changed

+317
-125
lines changed

26 files changed

+317
-125
lines changed

.jdk8

Whitespace-only changes.

pom.xml

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
<module>spring-cloud-gcp-pubsub</module>
2929
<module>spring-cloud-gcp-core</module>
3030
<module>spring-cloud-gcp-storage</module>
31+
<module>spring-cloud-gcp-starters</module>
32+
<module>spring-integration-gcp</module>
3133
</modules>
3234

3335
<properties>

spring-cloud-gcp-core/pom.xml

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@
1010
</parent>
1111

1212
<artifactId>spring-cloud-gcp-core</artifactId>
13+
<description>Spring Cloud GCP Core Module</description>
1314

1415
<dependencies>
15-
<dependency>
16-
<groupId>org.springframework.boot</groupId>
17-
<artifactId>spring-boot-autoconfigure</artifactId>
18-
</dependency>
1916
<dependency>
2017
<groupId>commons-logging</groupId>
2118
<artifactId>commons-logging</artifactId>

spring-cloud-gcp-core/src/main/java/org/springframework/cloud/gcp/support/GcpHeaders.java

-29
This file was deleted.

spring-cloud-gcp-dependencies/pom.xml

+35-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<description>Spring Cloud GCP Dependencies</description>
1717

1818
<properties>
19-
<google-cloud-java.version>0.18.0-alpha</google-cloud-java.version>
19+
<google-cloud-java.version>0.17.2-alpha</google-cloud-java.version>
2020
</properties>
2121

2222
<dependencyManagement>
@@ -26,6 +26,21 @@
2626
<artifactId>spring-cloud-gcp-core</artifactId>
2727
<version>${project.version}</version>
2828
</dependency>
29+
<dependency>
30+
<groupId>org.springframework.cloud</groupId>
31+
<artifactId>spring-cloud-gcp-pubsub</artifactId>
32+
<version>${project.version}</version>
33+
</dependency>
34+
<dependency>
35+
<groupId>org.springframework.cloud</groupId>
36+
<artifactId>spring-cloud-gcp-storage</artifactId>
37+
<version>${project.version}</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>org.springframework.cloud</groupId>
41+
<artifactId>spring-integration-gcp</artifactId>
42+
<version>${project.version}</version>
43+
</dependency>
2944
<dependency>
3045
<groupId>com.google.cloud</groupId>
3146
<artifactId>google-cloud</artifactId>
@@ -42,6 +57,25 @@
4257
<artifactId>commons-logging</artifactId>
4358
<version>1.2</version>
4459
</dependency>
60+
61+
<!--Starters-->
62+
63+
<dependency>
64+
<groupId>org.springframework.cloud</groupId>
65+
<artifactId>spring-cloud-gcp-starter-pubsub</artifactId>
66+
<version>${project.version}</version>
67+
</dependency>
68+
<dependency>
69+
<groupId>org.springframework.cloud</groupId>
70+
<artifactId>spring-cloud-gcp-starter-core</artifactId>
71+
<version>${project.version}</version>
72+
</dependency>
73+
<dependency>
74+
<groupId>org.springframework.cloud</groupId>
75+
<artifactId>spring-cloud-gcp-starter-storage</artifactId>
76+
<version>${project.version}</version>
77+
</dependency>
78+
4579
</dependencies>
4680
</dependencyManagement>
4781

spring-cloud-gcp-pubsub/.jdk8

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# This file makes the animal-sniffer plugin consider the project's code is Java 8.

spring-cloud-gcp-pubsub/pom.xml

-7
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,9 @@
4040
<scope>test</scope>
4141
</dependency>
4242

43-
<!-- SI channel adapter dependencies -->
44-
<dependency>
45-
<groupId>org.springframework.integration</groupId>
46-
<artifactId>spring-integration-core</artifactId>
47-
<optional>true</optional>
48-
</dependency>
4943
<dependency>
5044
<groupId>org.springframework.cloud</groupId>
5145
<artifactId>spring-cloud-gcp-core</artifactId>
52-
<optional>true</optional>
5346
</dependency>
5447
</dependencies>
5548
</project>
+13-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
/*
2-
* Copyright 2017 original author or authors.
2+
* Copyright 2017 original author or authors.
33
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
915
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
1516
*/
1617

17-
package org.springframework.cloud.gcp.pubsub.integration.converters;
18+
package org.springframework.cloud.gcp.pubsub.converters;
1819

1920
import com.google.protobuf.ByteString;
2021
import com.google.pubsub.v1.PubsubMessage;
22+
2123
import org.springframework.messaging.Message;
2224
import org.springframework.messaging.MessageHeaders;
2325
import org.springframework.messaging.converter.MessageConversionException;

spring-cloud-gcp-pubsub/src/main/java/org/springframework/cloud/gcp/pubsub/core/PubSubTemplate.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import com.google.pubsub.v1.TopicName;
3030

3131
import org.springframework.beans.factory.InitializingBean;
32-
import org.springframework.cloud.gcp.pubsub.integration.converters.SimpleMessageConverter;
32+
import org.springframework.cloud.gcp.pubsub.converters.SimpleMessageConverter;
3333
import org.springframework.messaging.Message;
3434
import org.springframework.messaging.converter.MessageConverter;
3535

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2017 original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
package org.springframework.cloud.gcp.pubsub.support;
19+
20+
/**
21+
* Google Cloud Platform internal headers for Spring Messaging messages.
22+
*
23+
* @author João André Martins
24+
*/
25+
public abstract class GcpHeaders {
26+
27+
private static final String PREFIX = "gcp_";
28+
29+
public static final String CONSUMER = PREFIX + "pub_sub_consumer";
30+
}

spring-cloud-gcp-pubsub/src/test/java/org/springframework/cloud/gcp/pubsub/integration/converters/SimpleMessageConverterTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import org.junit.Test;
1010
import org.junit.runner.RunWith;
1111
import org.junit.runners.JUnit4;
12+
13+
import org.springframework.cloud.gcp.pubsub.converters.SimpleMessageConverter;
1214
import org.springframework.messaging.Message;
1315
import org.springframework.messaging.MessageHeaders;
1416
import org.springframework.messaging.converter.MessageConversionException;

spring-cloud-gcp-starters/pom.xml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<artifactId>spring-cloud-gcp</artifactId>
8+
<groupId>org.springframework.cloud</groupId>
9+
<version>1.0.0.BUILD-SNAPSHOT</version>
10+
</parent>
11+
<packaging>pom</packaging>
12+
<name>Spring Cloud GCP Starters</name>
13+
<description>Spring Cloud GCP Starters</description>
14+
<artifactId>spring-cloud-gcp-starters</artifactId>
15+
<organization>
16+
<name>Pivotal Software, Inc.</name>
17+
<url>http://www.spring.io</url>
18+
</organization>
19+
<properties>
20+
<main.basedir>${basedir}/..</main.basedir>
21+
</properties>
22+
<modules>
23+
<module>spring-cloud-gcp-starter-pubsub</module>
24+
<module>spring-cloud-gcp-starter-core</module>
25+
<module>spring-cloud-gcp-starter-storage</module>
26+
</modules>
27+
28+
<dependencies>
29+
<dependency>
30+
<groupId>com.google.cloud</groupId>
31+
<artifactId>google-cloud</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.springframework.boot</groupId>
35+
<artifactId>spring-boot-autoconfigure</artifactId>
36+
</dependency>
37+
<dependency>
38+
<groupId>commons-logging</groupId>
39+
<artifactId>commons-logging</artifactId>
40+
</dependency>
41+
</dependencies>
42+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>org.springframework.cloud</groupId>
6+
<artifactId>spring-cloud-gcp-starters</artifactId>
7+
<version>1.0.0.BUILD-SNAPSHOT</version>
8+
</parent>
9+
<artifactId>spring-cloud-gcp-starter-core</artifactId>
10+
<name>Spring Cloud GCP Core Starter</name>
11+
<description>Starter for Google Cloud</description>
12+
<organization>
13+
<name>Pivotal Software, Inc.</name>
14+
<url>http://www.spring.io</url>
15+
</organization>
16+
<properties>
17+
<main.basedir>${basedir}/../..</main.basedir>
18+
</properties>
19+
</project>

spring-cloud-gcp-core/src/main/java/org/springframework/cloud/gcp/core/autoconfig/CredentialsAutoConfiguration.java spring-cloud-gcp-starters/spring-cloud-gcp-starter-core/src/main/java/org/springframework/cloud/gcp/core/autoconfig/CredentialsAutoConfiguration.java

-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
/*
2-
* Copyright 2017 original author or authors.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
171
package org.springframework.cloud.gcp.core.autoconfig;
182

193
import java.io.FileInputStream;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>org.springframework.cloud</groupId>
6+
<artifactId>spring-cloud-gcp-starters</artifactId>
7+
<version>1.0.0.BUILD-SNAPSHOT</version>
8+
</parent>
9+
<artifactId>spring-cloud-gcp-starter-pubsub</artifactId>
10+
<name>Spring Cloud GCP Pubsub Starter</name>
11+
<description>Starter for Google Cloud Pubsub messaging</description>
12+
<organization>
13+
<name>Pivotal Software, Inc.</name>
14+
<url>http://www.spring.io</url>
15+
</organization>
16+
<properties>
17+
<main.basedir>${basedir}/../..</main.basedir>
18+
</properties>
19+
<dependencies>
20+
<dependency>
21+
<groupId>org.springframework.cloud</groupId>
22+
<artifactId>spring-cloud-gcp-starter-core</artifactId>
23+
</dependency>
24+
</dependencies>
25+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<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">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.springframework.cloud</groupId>
7+
<artifactId>spring-cloud-gcp-starters</artifactId>
8+
<version>1.0.0.BUILD-SNAPSHOT</version>
9+
</parent>
10+
<artifactId>spring-cloud-gcp-starter-storage</artifactId>
11+
<name>Spring Cloud GCP Storage Starter</name>
12+
<description>Starter for Google Cloud Storage</description>
13+
<organization>
14+
<name>Pivotal Software, Inc.</name>
15+
<url>http://www.spring.io</url>
16+
</organization>
17+
<properties>
18+
<main.basedir>${basedir}/../..</main.basedir>
19+
</properties>
20+
<dependencies>
21+
<dependency>
22+
<groupId>org.springframework.cloud</groupId>
23+
<artifactId>spring-cloud-gcp-starter-core</artifactId>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.springframework.cloud</groupId>
27+
<artifactId>spring-cloud-gcp-storage</artifactId>
28+
</dependency>
29+
</dependencies>
30+
</project>

spring-cloud-gcp-storage/pom.xml

+12-6
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,23 @@
88
<groupId>org.springframework.cloud</groupId>
99
<version>1.0.0.BUILD-SNAPSHOT</version>
1010
</parent>
11-
1211
<artifactId>spring-cloud-gcp-storage</artifactId>
13-
12+
<description>Spring Cloud GCP Storage Module</description>
13+
<properties>
14+
<main.basedir>${basedir}/../..</main.basedir>
15+
</properties>
1416
<dependencies>
1517
<dependency>
16-
<groupId>com.google.cloud</groupId>
17-
<artifactId>google-cloud</artifactId>
18+
<groupId>org.springframework</groupId>
19+
<artifactId>spring-context</artifactId>
20+
</dependency>
21+
<dependency>
22+
<groupId>commons-logging</groupId>
23+
<artifactId>commons-logging</artifactId>
1824
</dependency>
1925
<dependency>
20-
<groupId>org.springframework.cloud</groupId>
21-
<artifactId>spring-cloud-gcp-core</artifactId>
26+
<groupId>com.google.cloud</groupId>
27+
<artifactId>google-cloud</artifactId>
2228
</dependency>
2329
</dependencies>
2430
</project>

spring-cloud-gcp-storage/src/main/java/org/springframework/cloud/gcp/storage/GoogleStorageProtocolResolver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ public Resource resolve(String location, ResourceLoader resourceLoader) {
6464
if (location.startsWith("gs://")) {
6565
return new GoogleStorageResource(this.storage, location);
6666
}
67-
return this.delegate.getResource(location);
67+
return null;
6868
}
6969
}

0 commit comments

Comments
 (0)